Craig,

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. 

Thanks.

Anand

-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
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 <[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]>

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

Reply via email to