tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Default classes loaded by Tocmat
Date Wed, 26 Dec 2001 19:50:06 GMT

On Wed, 26 Dec 2001, Anand Bashyam Narasimham wrote:

> Date: Wed, 26 Dec 2001 11:02:43 -0800
> From: Anand Bashyam Narasimham <>
> Reply-To: Tomcat Developers List <>
> To: "Tomcat Dev Mailing List (E-mail)" <>
> Subject: Default classes loaded by Tocmat
> Hi,
> I was wondering why default classes from core Java packages like
> "java.util.*" etc are not loaded automaitcally in the Classloader. Does the
> spec say anything about this. I do know that a lot of the Servlet engines in
> the market do such automatic classloading. Can someone tell me why this is
> not done so in  Tomcat?

Servlet Specification, Version 2.3, Section 9.7.2:

    "It [the application class loader] must not
    allow the WAR to override J2SE or Java servlet
    API classes."

Thus, the webapp class loader MUST refuse to load java.* and
javax.servlet.* classes from /WEB-INF/classes or /WEB-INF/lib, or else it
is broken.  However, it will delegate such requests to the parent class
loader, so your application uses the versions of things like
java.util.HashMap that are provided by the JDK or JRE you are running
under.  By the same token, trying to put servlet.jar inside a web app
will be ignored -- the servlet.jar that Tomcat provides is used to supply
the servlet and JSP API classes.

For more information on how Tomcat 4 class loading works, see the
documentation that is included with Tomcat, or available online:

> Thanks
> Anand B N
> Associate Developer,Engineering
> 1320 Harbor Bay Parkway
> Alameda,CA
> Phone - (415) 625 41976

Craig McClanahan

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message