You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Larry Meadors <La...@plumcreek.com> on 2003/03/01 00:48:52 UTC

Re: WEB-INF/classes not loading from corrrect classloader

Does this happen with the JPDA debugger, or running tomcat inside your
IDE?

>>> tomcat-user@frontloader.net 02/28/03 16:38 PM >>>
Hello,
While I'm having no problems running *outside* a debugger, I am running 
into a problem with classloading as I try to run 2 web-application 
through a debugger.  The two projects have overlapping copies of 
the same class files (ie, both projects use Class A).  The problem 
is that when Tomcat (4.0.6) is run through my debugger, the
WEB-INF/classes 
are not loaded by org.apache.catalina.loader.WebappClassLoader.  
They are apparently loaded by the system classloader.  So my Class 
A instance is shared between my 2 web-apps when in fact they should 
each have their own instance.  Run outside the debugger, the
WebappClassloader 
does its job & both web-apps get their unique copies of class A. 
Here is what Class A has to say about who's loading it:

Outside the debugger:
---------------------
Class A's ClassLoader's class is [class org.apache.catalina.loader.
WebappClassLoader]
ClassLoader's parent class is [class
org.apache.catalina.loader.StandardClassLoader]
ClassLoader's parent class is [class
org.apache.catalina.loader.StandardClassLoader]
ClassLoader's parent class is [class sun.misc.Launcher$AppClassLoader]
ClassLoader's parent class is [class sun.misc.Launcher$ExtClassLoader]

Inside the debugger:
--------------------
SettingsMgr@73a7ab ClassLoader's class is [class
sun.misc.Launcher$AppClassLoader]
ClassLoader's parent class is [class sun.misc.Launcher$ExtClassLoader]

Is there a way that I can prevent the WEB-INF classes from being 
loaded by the System classloader when using the debugger?  I know 
this was part of the servlet spec as the Tomcat documentation notes:


"The web application class loader diverges from the default Java 
2 delegation model (in accordance with the recommendations in the 
Servlet Specification, version 2.3, section 9.6). When a request 
to load a class from the web application's WebappX class loader is 
processed, this class loader will look in the local repositories 
first, instead of delegating before looking."

So why isn't WebbappClassLoader loading the WEB-INF/classes when 
debugging?  Thanks in advance for your help!

Craig








---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org