Glassfish 4 deployment error

I added some libraries to my JavaEE project and then deployed the application. I changed 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 did some research and I found out that this is not an Eclipse bug. I work with Kepler, but I also tested Juno. Received the same error message. I downloaded Glassfish 3.1.2.2 and the message disappeared.

Why am I receiving this message?

+7
java eclipse java-ee glassfish glassfish-4
source share
7 answers

I had the same error. I stopped the GLassfish server and then cleaned up the project (Project -> Clean ...). The server started and worked

+4
source share

I also had this problem, and I also used the SVNKit library and its dependencies, so it seems like there is some kind of conflict there. I can get around this by clearing the osgi-cache folder and restarting the glass fish, but I have to do this every time I want to deploy, so this is not a good solution.

+3
source share

Try deleting all files in osgi-cache and the generated directories. It worked for me.

+1
source share

Try to clear the startup directory, restart the server. Also empty the project deployment directory.

0
source share

Somehow related to one @Singleton bean. Converted it to @Stateless , and everything worked fine. Not quite sure why this happened ...

0
source share

My Glassfish log file says:

An application named ws is already registered. Either specify that the redistribution should be forced, or redistribute the application. Or, if this is a new deployment, select a different name

Following the instructions in my log, I deployed the application using the --force option:

 asadmin deploy --force=true ws.war 

and it worked. Additional information about deploy --force = true

0
source share

The following steps worked for me.

  • stop the Glassfish server (if running)
  • kill the whole java process (using terminal or activity monitor)
  • now try redeploying.
0
source share

All Articles