I have an EAR file that contains two different jars that share some classes with an identical package+class name. This results in importance of classloading inside the EAR file itself.
How can I tell Weblogic to load one jar from APP-INF/lib before loading a different one in the same APP-INF/lib? I need to define a specific order to that if there is a conflict, it will take from JAR a and not JAR b.
I'm using Webogic 11g (10.3).
Thanks.
The top-level element in weblogic-application.xml
has an optional classloader-structure element that you probably want to look into. For instance you can do something like:
<classloader-structure>
<module-ref>
<module-uri>ejb1.jar</module-uri>
</module-ref>
<module-ref>
<module-uri>web3.war</module-uri>
</module-ref>
<classloader-structure>
<module-ref>
<module-uri>web1.war</module-uri>
</module-ref>
</classloader-structure>
</classloader-structure>
Read more about declaring custom class loading at these Oracle docs. You may also find the Classloader Analysis Tool (CAT) at the same link of interest.
If you're getting ClassNotFound exceptions, try checking out the MANIFEST.MF for each of your modules to see if the "Class-Path" attribute is correctly populated with the locations of your jars in your APP-INF/lib - I've just spent a week or more tearing my hair out trying to find a solution to a similar problem, and this is what fixed it.
来源:https://stackoverflow.com/questions/27721922/how-to-set-the-orders-of-jars-in-weblogic-ear