Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish 4 deployment error

I added some libraries to my JavaEE project and then deploy the application works. I modified something and I got this error message in Eclipse:

Cannot Deploy ProjectName
deploy is failing=Error occurred during deployment: Keys cannot be duplicate. 
Old value of                 this key property, nullwill be retained. 
Please see server.log for more details.
java.lang.LinkageError: loader (instance of  
org/glassfish/web/loader/WebappClassLoader):
attempted  duplicate class definition for name: 
"org/glassfish/web/loader/JdbcLeakPrevention"
loader (instance of  org/glassfish/web/loader/WebappClassLoader): attempted  duplicate 
class definition for name: "org/glassfish/web/loader/JdbcLeakPrevention"

I made some research and I found out that it is not an Eclipse bug. I'm working with Kepler but I tested with Juno too. Got the same error message. I downloaded Glassfish 3.1.2.2 and the message gone.

Why am I getting this message?

like image 404
Arnold Galovics Avatar asked Oct 30 '13 12:10

Arnold Galovics


4 Answers

I Had the same error. I stopped the GLassfish server and then I cleaned the project (Project -> Clean... ). Started the server and worked

like image 109
Catalin Ciolocoiu Avatar answered Nov 12 '22 18:11

Catalin Ciolocoiu


In my Glassfish log file it says:

Application with name ws is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name

Following my logs instructions I deployed the app with --force option:

asadmin deploy --force=true ws.war

and it worked. More info on deploy --force=true

like image 44
jyrkim Avatar answered Sep 20 '22 12:09

jyrkim


I also had this issue, and I was also using the SVNKit library plus its dependencies so it looks like there is some kind of conflict there. I can get around it by cleaning out the osgi-cache folder & restarting glassfish, but I have to do this every time I want to deploy, so not a great solution.

like image 3
Martin Charlesworth Avatar answered Nov 12 '22 18:11

Martin Charlesworth


Try to remove all the files under osgi-cache and generated directories. It worked for me.

like image 2
Renato Herebia Avatar answered Nov 12 '22 19:11

Renato Herebia