tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anand Bashyam Narasimham <>
Subject RE: Default classes loaded by Tocmat
Date Wed, 26 Dec 2001 19:56:45 GMT

I get the idea but as u said if the Web-app class loader delegates it to the
Parent Class loader and at some point it will go to the VM's primary class
loader. If that is how it works then while I start tomcat my entire JDK's
classes are in the Class path so if I have a JSP that uses java.util.Vector
and not included in the "<@import" list the JSP should compile. However it
does not. I'm using tomcat 3.3 If I remember right there was a significant
change in how classes are loaded from 3.3 to 4.0. 



-----Original Message-----
From: Craig R. McClanahan []
Sent: Wednesday, December 26, 2001 11:50 AM
To: Tomcat Developers List
Subject: Re: Default classes loaded by Tocmat

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
> spec say anything about this. I do know that a lot of the Servlet engines
> 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: <>

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

View raw message