How to specify load order of JAR class in weblogic
I have an EAR file that contains two different jars that share some classes with the same package.class name. These JARs are deployed in my APP-INF / lib directory.
Suppose jar contains the latest version of the classes and B is the old version of the classes. When a class is referenced, Weblogic looks at the B-jar first and loads the old version, which breaks some functionality.
How can I tell Weblogic to download jar A to B from APP-INF / lib? I need to define a specific order to avoid loading old classes.
I've already tried adding A jar to <classloader-structure>
in weblogic-application.xml
like so:
EAR structure:
EAR
\--->A.jar
\--->webapp.war
.....
WebLogic-application.xml:
<classloader-structure>
<module-ref>
<module-uri>A.jar</module-uri>
</module-ref>
.......
</classloader-structure>
but then it throws an error saying
weblogic.management.DeploymentException: classloader-structure element in weblogic-application.xml is referencing the module-uri A.jar which does not exist in this application.
Also keep in mind that A.jar is not a module, war, or EJB - just a simple hibernate library: hibernate-jpa-2.0-api-1.0.1.Final.jar
I am using Weblogic 12c version.
source to share
You need to set the parent last strategy for the loader class, refer to http://www.rgagnon.com/javadetails/java-0551.html , since I remember the webserver has a GUI, do the same.