Question

Does somebody know in which order of precedence are the jars loaded?

Having several jars in WEB-INF/lib (in a war inside an ear in WAS 6.1).

Let's say aaa.jar, bbb.jar, ccc.jar. I have two different versions of a class paq1.paq2.paq3.MyClass inside aaa.jar and ccc.jar

The one inside ccc.jar is the correct one; the one in the aaa.jar is the wrong.

It seems that the wrong version is localized before the correct one.

Does somebody know what I have to do to guarantee that ccc.jar is loaded before aaa.jar?

(This is a simplification of a more real/complex problem, so renaming jars doesn't apply in this case).

Thank you in advance

Was it helpful?

Solution 3

WebSphere Application Server makes no guarantees about the ordering of JARs within WEB-INF/lib, and there is no option to force a particular ordering. I recommend removing duplicate classes and resources.

OTHER TIPS

I don't believe the servlet specification guarantees any specific Classpath ordering for the jars in the lib-folder. Hence you are looking at vendor specific functionality or - even worse - vendor specific accidental behavior, which tends to be very brittle.

If the bad class is in your deployment, the cure is removing the bad class definitions from your deployment. I would suggest that your build procedure is responsible for this.

If the bad class is in WAS itself you can usually override it by putting jars in an extension folder in the server itself, not as part of your deployment.

JVM takes class from the first jar in class path, where appropriate class exists. All others are discarded. You can remove this jars from WEB-INF and put them directly to webserver's class path. But this will be ugly solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top