tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: What Do We Do With The User's Classpath?
Date Thu, 13 Jul 2000 22:39:46 GMT
Alex Chaffee wrote:

> I'm very shaky on the whole classloader issue -- can someone confirm
> that I've just described its actual behavior?  Craig did imply that
> that's how it really works...

Uh oh.

I just had a look at AdaptiveClassLoader.  It implements
ClassLoader.loadClass() like

1) Attempt to load from the "parent" class loader
    if one is defined (it's not clear that this is ever
    set -- on Java2 systems it should be the same
    as the system class loader).

2) Attempt to load from the system class loader
    (i.e. the one that follows CLASSPATH).

3) Attempt to load from the local repositories (WEB-INF/classes and

It does the same kind of thing for ClassLoader.getResource() and

This ordering is contrary to what I've always assumed (and contrary to
what is built
in to Catalina -- it does #3 then #2 and doesn't have a separate parent
class loader),
and is probably the cause for gobs of peoples's problems, because it
puts the system
class path ahead of the web applications repositories.  For example, it
means that you
cannot use an application-specific class from your repository at all if
there is a
class with the same name somewhere on the system classpath.

I propose to change this order to #3 -> #1 -> #2 on the main branch, and
then have
people test it before we commit it to the 3.2 branch.  Comments?  Votes?


View raw message