Sunday, January 22, 2006

IBM WebSphere 5 Classloaders

Abundant articles are available on WebSphere classloaders.


Just to reiterate one important point:

Several issues in WebSphere version 4.x have been resolved in WebSphere 5.x.
For example: If in a WAS5 ear there are multiple WARs and each WAR needs to reuse a utility jar and the reference is given in the manifest, the jar class loader will load up the utility only ONCE.

In a project I was working there was debate and almost certainly a hack was planned by delinking wars from their manifests and adding those manifests in a shell EJB projects (!)

Here is a sample classloader hierachy:
Application is set to Parent First
War is set to Parent last.

EJB ClassLoaders
com.ibm.ws.classloader.ExtJarClassLoader
sun.misc.Launcher$ExtClassLoader
sun.misc.Launcher$AppClassLoader
com.ibm.ws.bootstrap.ExtClassLoader
com.ibm.ws.classloader.ProtectionClassLoader
com.ibm.ws.classloader.CompoundClassLoader

WAR Classloaders

com.ibm.ws.classloader.CompoundClassLoader
com.ibm.ws.classloader.ExtJarClassLoader
sun.misc.Launcher$ExtClassLoader
sun.misc.Launcher$AppClassLoader
com.ibm.ws.bootstrap.ExtClassLoader
com.ibm.ws.classloader.ProtectionClassLoader
com.ibm.ws.classloader.JarClassLoader

You can view your hierarchy with the classloader viewer, read and download from here.