Share this page 

Reverse the CLASSLOADER order (BEA)Tag(s): Servlet/JSP

By default, Weblogic loads a class by asking the parent classloader to load the required class. This can be a problem, if you have a JAR version in the server LIB directory and your web app requires an another version.

ref : WebLogic Server Application Classloader Overview

To make sure that your web app will use the JAR located in its WEB-INF\LIB, create a file called weblogic.xml in the WEB-INF directory with the content :

<!DOCTYPE weblogic-web-app PUBLIC
    "-//BEA Systems, Inc.//DTD Web Application 8.1//EN"


Another technique is to use a FilteringClassLoader.

The FilteringClassLoader provides a mechanism for you to configure deployment descriptors to explicitly specify that certain packages should always be loaded from the application, rather than being loaded by the system classloader.

To configure the FilteringClassLoader to specify how a certain package is to be loaded, add a prefer-application-packages descriptor element to the weblogic-application.xml

The following example specifies that org.apache.log4j.* is loaded from the application, not the system classloader:

ref :