Middleware
Application Server
Date: 07/03/02
In the Java2 platform, classloaders are responsible for providing the classes that the Java VM and an application require at runtime. The classloaders use a standard mechanism called the "parent delegation model" to actively find and load the classes. This delegation model uses a hiercachical approach, with there being a root classloader for the whole Java VM, and then a set of surrogate classloaders cascading down through the various layers. Other than the root class loader, each classloader has a parent classloader. This hierachy determines how classes are found and loaded. For example, normally a class loader first tries to get classes from it's parent class loader and if it's not available there, then it tries to load the classes directly from it's code sources. The OC4J Web application classloader follows this delegation model by default. If there are two classes with the same name, for example MyFoo.class packaged in the WAR file and MyFoo.class packaged in a jar file in $OC4J_HOME/j2ee/home/lib directory then MyFoo.class from the JAR file will be used.
In OC4J v9.0.3 and above you can configure the Web application classloader to override this behavior and direct it to load local classes in preference to classes from a higher level. To do this for a specific Web application, you specify the following tag in the orion-web.xml for the Web module. If you wish to have this behavior at a global level you enter the tag in the $OC4J_HOME/j2ee/home/config/global-web-application.xml file.
<orion-web-appdeployment-version="9.0.3.0.0"
jsp-cache-directory="./persistence"
temporary-directory="./temp"
servlet-webdir="/servlet/">
<web-app-class-loader search-local-classes-first="true" />
</orion-web-app>
java -jar admin.jar ormi://<
host
>
<
uid> <
pwd>
-deploy -file
<
directory>/
override-sys-classes.ear -deploymentName override-sys-classes
java -jar admin.jar ormi://<
host
>
<
uid> <
pwd>
-bindWebApp override-sys-classes override-sys-classes-web http-web-site /override
<web-app-class-loader search-local-classes-first=" true"/>
In this exercise you should have learned to: