简体   繁体   中英

Weblogic Prefer application packages not working

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 ?

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>

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