On Thu, 18 Oct 2001, E B wrote:
> Date: Thu, 18 Oct 2001 09:52:50 +0100 (BST)
> From: E B <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED]
> Cc: 'E B' <[EMAIL PROTECTED]>
> Subject: RE: webapps' classpath
>
> I think I can get around this problem by moving
> to tomcat 4. There seems to be a shared classloader
> for all the webapps. But I am wondering if other
> app servers also support tomcat-4's classloading
> structure, otherwise my app will become tc4-only.
>
All servlet containers that support the 2.2 or 2.3 specification are
required to provide a separate classloader per web application. The
availability of a shared JAR mechanism is not required by the spec, but is
very commonly implemented.
In a servlet 2.3 environment, the following additional notes are relevant:
* There is a "SHOULD" statement in the specification with
regards to checking in the webapp's class loader first
before checking higher up the class loader hierarchy.
Tomcat 4 implements this "SHOULD" (although you can turn
it off if you want to), but I don't know how others are
handling it.
* Web applications can count on the Thread context class loader
being set to the webapp's class loader. This means that, in
library code that *is* loaded from a shared classloader,
you can still load application classes from the webapp
class loader if you take steps like this:
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Class clazz = cl.loadClass("... classname ...");
Craig McClanahan