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

> Date: Wed, 26 Dec 2001 11:02:43 -0800
> From: Anand Bashyam Narasimham <[EMAIL PROTECTED]>
> Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> To: "Tomcat Dev Mailing List (E-mail)" <[EMAIL PROTECTED]>
> 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:

  http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html


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

Craig McClanahan


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to