2
votes

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

1 Answers

8
votes

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>