How to set order of jars in WebLogic?

拥有回忆 提交于 2019-11-26 06:45:59

问题


In my application I am using Joda-Time 2.0 but in my WebLogic path there is library Joda-Time 1.2.

How can I change the order and tell WebLogic to use my library? Now it is using its own library, not mine. I just added a Maven project dependency to Joda-Time 2.0.


回答1:


There are several ways of doing this.

  1. Change your startWeblogic.cmd(sh) in the bin folder for your domain, look for the classpath setting and add the new joda before any other WebLogic jars
  2. as was said above, you can change your weblogic.xml if the application is a web application and chose to prefer any lib that comes inside the war.
  3. If you are using an Enterprise application, you can set the following options in your weblogic-application.xml:

    <prefer-application-packages>
        <package-name>org.apache.*</package-name>
        <package-name>antlr.*</package-name>
    </prefer-application-packages>
    

And set your package name for joda in there.

Please note that the first option might result in strange behavior from WebLogic.

Note for some reason I can't get the code to work with the XML.




回答2:


As your class is present in your war, WEB-INF/lib,

can you try using the weblogic.xml setting to force the WEB-INF/lib class to get loaded in preference to that in server/lib with

<container-descriptor>     
<prefer-web-inf-classes>true</prefer-web-inf-classes>   
</container-descriptor> 


来源:https://stackoverflow.com/questions/7187581/how-to-set-order-of-jars-in-weblogic

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