Title: RE: Cannot find my JavaBeans

Ok, based upon previous posts, I think I might have an idea of why this happens.

Tomcat uses its own classloader(AdaptiveClassLoader) to load servlets/jsps. when that servlet/jsp needs a class(abcBean) the AdaptiveClassLoader tries to load the class. If it cannot load the class from the classes it knows about, in this case web-inf/classes, it will pass the request to load a class to its parent classloader.

See http://www.mail-archive.com/[email protected]/msg13260.html for the full classloader heirarchy.

In the case of a new Thread object, the AdaptiveClassLoader cannot resolve it, therefore it asks its parent and eventually the bootstap(jvm's) classloader will load the class. Now when the thread class needs to load a class(abcBean), the bootstrap classloader looks for it in the only place it is aware of - the classpath. And since the bootstrap loader doesn't not know about the AdaptiveClassLoader, it cannot forward the request to load the class to it, thus the class cannot be found.

I don't know why it is different for run() than for start() - I haven't used either, so I don't understand what the difference in the two is in the Thread class(doesn't start() call run()?)

hope this helps,
Charlie

> -----Original Message-----
> From: John Baker [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 12:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Cannot find my JavaBeans
>
>
> On Wednesday 18 July 2001 17:15 pm, you wrote:
> > > This seems to be a bug in Tomcat. Shouldn't someone who
> actually knows
> > > how it all works take a look?
> > >
> > > John
> >
> > Yep. Even the cocoon mailing list is full with entries
> related to tomcat
> > and its classpath :-). Under some misterious circumstances the
> > "<context</WEB-INF/lib" Classpath disappears.
> >
> Well I managed to make it a very non mysterious circumstance.
> I just started
> a Thread from an object that was a ServletContextListener.
> When I called
> start it lost classes. When I called run it worked fine. I
> had no problems
> replicating it.
>
> What is the cocoon mailing list?
>
> --
> John Baker, BSc CS.
> Java developer, Linux lover.
> I don't wanna rock, DJ.
>

Reply via email to