tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: ClassLoader problems - might be a bug
Date Mon, 10 Apr 2000 16:27:20 GMT
Harish wrote:

> > Tomcat class loader ( AdaptiveCL) is used to load web applications only.
>
> I am not sure which classloader it is.( AdaptiveCL or NWCL or someother
> CL). I was talking of the classloader Tomcat uses to load any class in
> general.

There are at least three classloaders involved in Tomcat:

* The CL that is used to load Tomcat itself (which includes interceptors
and
  must also be able to access any class required by those interceptors).
  The system class loader is used for this.

* The CL that loads classes for a particular web application.  This one
looks
  in WEB-INF/classes and WEB-INF/lib/*.jar first, then the system class
path
  second.

* The CL that loads the compiled classes for JSP pages.

> I think Tomcat doesn't directly use the System class loader to
> load classes. In case Tomcat's own class loader can't load a class, it
> must be passing the job on to the System class loader. Is it not so?
>  I think Tomcat fails in doing that. I'm not VERY SURE if it is exactly
> so. wanted to check with you. Right now i have my own classloader
> loading it.

If you are using your own class loader, these classes won't be visible
to the rest
of Tomcat unless they can also access that classloader.  You want all
classes that
are part of Tomcat (which includes interceptors and any classes they
require) to be
loaded normally, with no special references to your own class loaders.

> If you can tell me which class Tomcat uses to load classes(
> not webapps)  before it starts off with the servlet-serving stuff it
> does, I'll check it out.

It uses the system classloader -- all classes loaded at init time must
be visible in
the CLASSPATH.

>
> > Interceptors are part of tomcat - if you place them in a webapp you can't load
> > them.
> > ( since they are loaded before web apps are loaded, and web apps may reload,
> > be unloaded, etc)
>
> I wasn't even trying to load an Interceptor. What i meant was i was
> trying to load the class(which i was referring to) inside the code of an
> Interceptor.
>

Likewise, this code must be visible on the CLASSPATH.

>
> Harish

Craig

Mime
View raw message