Weblogic Prefer application packages not working

别说谁变了你拦得住时间么 提交于 2019-12-02 05:35:00

问题


I am using Weblogic 10.3.6 portal server. Weblogic 10.3.6 always uses common-fileupload jar that comes with weblogic. But I want the server to use the one I have inside my war.

Use case is I have war1 it uses apache jars which are inside war2. I added below lines in weblogic.xml of both wars but it is not working and still loading weblogic specific jars.

<wls:container-descriptor>
    <wls:prefer-application-packages>
      <wls:package-name>com.sample.*</wls:package-name>
    </wls:prefer-application-packages>  
  </wls:container-descriptor> 

Any idea why the jar inside the wars are not been used ?


回答1:


In order to use prefer-application-packages prefer-web-inf-classes must be set to false.

An example from WebLogic documentation:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
  <container-descriptor>
    <prefer-web-inf-classes>false</prefer-web-inf-classes>
    <prefer-application-packages>
      <package-name>javax.faces.*</package-name>
      <package-name>com.sun.faces.*</package-name>
      <package-name>com.bea.faces.*</package-name>
    </prefer-application-packages>

    <prefer-application-resources>
      <resource-name>javax.faces.*</resource-name>
      <resource-name>com.sun.faces.*</resource-name>
      <resource-name>com.bea.faces.*</resource-name>
      <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
      </prefer-application-resources>
  </container-descriptor>
</weblogic-web-app>


来源:https://stackoverflow.com/questions/45375774/weblogic-prefer-application-packages-not-working

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