Sunday, 11 August 2013

Weblogic application classloading of utility jar classes from other jars in the same webapp

Weblogic application classloading of utility jar classes from other jars
in the same webapp

I am faced with a puzzle around some classloading issues with my
application in Weblogic. There are some places in my code where there are
classes which depend on classes from other jars and I must be missing
something fundamental.
From reviewing information I can find, this shouldn't be a problem if both
jars are on the classpath, but this seems to be more subtle in a Java EE
application context on Weblogic.
I have an Ear, MyApp.ear
MyApp.ear contains several webapps (war) and a whole bunch of utility jars
and EJBs. Structure is something like this ( I don't control it).
MyApp.ear
MyWebApp.war
UtilJar1.jar
UtilJar2.jar
etc...
Let's say that there are classes in UtilJar1 that import classes from
UtilJar2. What MANIFEST.MF should specify that both jars should be on the
classpath? The EAR's? The Webapp's? UtilJar1's?
From trial and error (Weblogic 10.3.2), the only way that this seems to
work is if UtilJar2 is defined in the Manifest class-path of UtilJar1. But
I would have thought that in the context of a webapp that the webapp's
classpath would be used for any classloading happening in that webapp?
Instead I see NoClassDefFound unless the second jar is specified in the
classpath of the first.

No comments:

Post a Comment