It happens inside the debugger (Eclipse). Basically, what I have come to realize is happening is that Eclipse implicitly includes the current project (in my case the web-app) in the system classpath. So when I start tomcat by invoking Bootstrap.main thru the debugger, the project/application classfiles are always going to be loaded by the application/system classloader, not the webapp classloader. I found a plugin by sysdeo.com that solves this by calling bootstrap indirectly, so as not to include the application in the system classpath.
Thanks, Craig At Friday, 28 February 2003, "Larry Meadors" <[EMAIL PROTECTED] com> wrote: >Does this happen with the JPDA debugger, or running tomcat inside your >IDE? > >>>> [EMAIL PROTECTED] 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: >-------------------- >[EMAIL PROTECTED] 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: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
