简体   繁体   中英

How to specify order of JAR class loading in weblogic

I have an EAR file that contains two different jars that share some classes with an identical package.class name. These JARs are deployed in my APP-INF/lib directory.

Let's say A jar contains the latest version of classes and B contains the old version of classes. When a class is referenced Weblogic looks first into B jar and loads the old version which break some functionality.

How can I tell Weblogic to load jar A before B from APP-INF/lib? I need to define a specific order to avoid loading old classes.

I have 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 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 one thing to remember is that A.jar is not a module, war or EJB it just a plain hibernate library: hibernate-jpa-2.0-api-1.0.1.Final.jar

I am using Weblogic 12c version.

你需要为class-loader设置父最后一个策略,请参考http://www.rgagnon.com/javadetails/java-0551.html ,因为我记得weblogic服务器中有一个GUI来做同样的事情。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM