简体   繁体   English

如何在weblogic中指定JAR类加载的顺序

[英]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. 我有一个EAR文件,其中包含两个不同的jar,它们共享一些具有相同package.class名称的类。 These JARs are deployed in my APP-INF/lib directory. 这些JAR部署在我的APP-INF / lib目录中。

Let's say A jar contains the latest version of classes and B contains the old version of classes. 假设一个jar包含最新版本的类,B包含旧版本的类。 When a class is referenced Weblogic looks first into B jar and loads the old version which break some functionality. 当引用类时,Weblogic首先进入B jar并加载破坏某些功能的旧版本。

How can I tell Weblogic to load jar A before B from APP-INF/lib? 如何告诉Weblogic从APP-INF / lib加载B之前的jar A? 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: 我已经尝试将a jar添加到weblogic-application.xml <classloader-structure> ,如下所示:

EAR structure: EAR结构:

EAR
\--->A.jar
\--->webapp.war
.....

weblogic-application.xml: 的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 另外要记住的一点是A.jar不是模块,war或EJB它只是一个普通的hibernate库: hibernate-jpa-2.0-api-1.0.1.Final.jar

I am using Weblogic 12c version. 我使用的是Weblogic 12c版本。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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