tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elgs Chen <>
Subject Re: WebClassLoader using SystemClassLoader to load ServletDef?
Date Tue, 25 Sep 2012 15:04:17 GMT
Hi Mark,

Thanks for your fast answer. That helped me to narrow down the scope of this problem. I understand
line 262 is to initialize and create the common, shared and catalina class loaders. But I'm
still struggling how the WebappClassLoader.loadClass(String name, boolean resolve) be able
to load the class ServletDef. Can you please give me some more insight into this method? I
think the it should load the class via the catalina class loader as my previous assumption
1 was wrong. If this is the case, How does this method achieve that?

Many thanks,

On Sep 25, 2012, at 9:28 PM, Mark Thomas <> wrote:

> On 25/09/2012 13:19, Elgs Chen wrote:
>> Dear Tomcat Developers,
>> I have a question regarding the behavior of the WebClassLoader.loadClass(String name,
boolean resolve) in the org.apache.catalina.loader package.
>> I have the following assumptions, please correct me if any is wrong:
>> 1, It seems the WebClassLoader only uses the SystemClassLoader (or AppClassLoader)
to loader tomcat core classes, like ServletDef;
> Wrong. See [1].
>> 2, It seems if tomcat is started up by the from the bin directory, the
classpath in the startup command line will include only the jars in the bin directory: bootstrap.jar,
commons-daemon.jar and tomcat-juli.jar;
> Correct.
>> 3, ClassLoader.getSystemClassLoader() by default returns the class loader with the
startup command-line classpath; 
> Correct.
>> Now if the above three assumption are correct, it seems that it's not possible for
the WebClassLoader to load the tomcat core classes as only the few bootstrap jars are in the
system class loader's classpath. However, the fact is the script indeed starts
tomcat up. Why?
> The logical conclusion would be that one or more of the assumptions is
> wrong.
>> So my question is:
>> How does the shipped with tomcat binary make the WebClassLoader to load
the ServletDef?
> See [2], line 262.
> Mark
> [1]
> [2]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message