How to set the orders of jars in Weblogic EAR?

夙愿已清 提交于 2019-12-08 07:17:22

问题


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.


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!