See intermixed. On Fri, 15 Nov 2002, Sri Sankaran wrote:
> Date: Fri, 15 Nov 2002 15:10:02 -0500 > From: Sri Sankaran <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: Struts Users Mailing List <[EMAIL PROTECTED]> > Subject: RE: [OT] Tomcat class loading > > Intermixed... > > > -----Original Message----- > > From: Craig R. McClanahan [mailto:craigmcc@;apache.org] > > Sent: Friday, November 15, 2002 2:58 PM > > To: Struts Users Mailing List > > Subject: Re: [OT] Tomcat class loading > > > > > > > > > > On Fri, 15 Nov 2002, Sri Sankaran wrote: > > > > > Date: Fri, 15 Nov 2002 14:38:40 -0500 > > > From: Sri Sankaran <[EMAIL PROTECTED]> > > > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > > > To: Struts-User <[EMAIL PROTECTED]> > > > Subject: [OT] Tomcat class loading > > > > > > > > > It seems as if the class-loader that loaded a particular class > > > maintains some kind of reference to the class. Any dependent class > > > can be loaded only by this loader or any one up the Tomcat hierarchy > > > > > > Bootstrap > > > | > > > System > > > | > > > Common > > > / \ > > > Catalina Shared > > > / \ > > > Webapp-1 Webapp-2 > > > > > > So in other words, if Class-A is loaded by the Common > > classloader and > > > Class-A requires Class-B the search will only be conducted by the > > > Bootstrap classloader, the System classloader and the Common > > > classloader (in that order). > > > > > > > If you are just doing standard Java style instantiations: > > > > Foo f = new Foo(); > > > > then you are correct -- Java looks up but not down. In fact, > > there is no way to go down, because a java.lang.ClassLoader > > instance has no knowledge of other class loaders that > > consider it to be a parent. > > 10-4. What I meant to ask is, is there any association maintained > between the loaded class and the class loader that loaded it? > Absolutely. A ClassLoader knows all the Class instances it has loaded. Among other things, that is why a single Class instance is only loaded once, no matter how many times new instances of that class are created. > Here's what I saw today in resolving a classpath issue: Suppose Foo > above is required by a webapp and is loaded by the Shared classloader. > Now, if Foo references Bar, only the Bootstrap, System, Common and > Shared classloaders are apparently being queried. That's correct. > Even though Foo is > being used by the webapp. Is this expected behavior? Yes. That is exactly how class loading works in Java. Craig -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

