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,
Elgs


On Sep 25, 2012, at 9:28 PM, Mark Thomas <ma...@apache.org> 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 startup.sh 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 startup.sh 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 startup.sh shipped with tomcat binary make the WebClassLoader 
>> to load the ServletDef?
> 
> See [2], line 262.
> 
> Mark
> 
> 
> [1] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
> [2]
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?view=annotate
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to