File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Glassfish and the fly likes Glassfish 3 - 2 wars - log4j on class path twice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Glassfish
Bookmark "Glassfish 3 - 2 wars - log4j on class path twice" Watch "Glassfish 3 - 2 wars - log4j on class path twice" New topic

Glassfish 3 - 2 wars - log4j on class path twice

Ally Cavs
Ranch Hand

Joined: Aug 25, 2008
Posts: 89
Hi Guys

If I deploy either War on its own in GF3 and the app works fine.

When I deploy the second I get an exception on deployment to say Log4jException is on the class path twice
The 2 wars package their jars in the lib folder at root level. I thought each app has its own class path and should not conflict. But this is not the case.
I listed all jars in lib folder in the manifest file. this did not solve the problem. In only did this for 1 war though.and i used maven to do this. maven listed the jar names not lib/jar_Name.jar which is what I was expecting to see

I have a number of applications i need to deploy so its a big job to start pulling out common jars and puting them in the domain's lib folder.
Any advice on how to force GF3 to make sure to use the library bundled in the particular war in question?

Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

I think it would make more sense to put your Log4J JAR in the server's common library, and refer to that library from your WAR code instead of bundling it in with each app.

If you must bundle Log4J with each app, you could just deploy the WARs to different domains.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
I agree. Here's the link:
subject: Glassfish 3 - 2 wars - log4j on class path twice
It's not a secret anymore!