Hi Leo,

On Thu, Nov 22, 2001 at 09:40:09AM +0100, Leo Sutic wrote:
> 
> Line 86:
>                 logTargetFactory =
>                     (LogTargetFactory)
> this.getClass().getClassLoader().loadClass( factoryClass ).newInstance();
> 
> This leads to some classloader issues. Is there a reason for this or can the
> context class loader be used instead?

If I may take the opportunity to ask.. is the general rule that one
should prefer the context classloader to that of the code's class?

Ie, Thread.currentThread().getContextClassLoader() instead of
this.getClass().getClassLoader()?

I notice that Cocoon2's ClassUtils always returns the context CL. I'm
guessing that the context CL is more flexible, because the caller may
belong to a less "primitive" classloader than the excalibur code. Does
that sound right?

Eg, say that avalon-excalibur.jar is in Tomcat 3.2's $TOMCAT_HOME/lib.
Your class in WEB-INF/lib tries to set the factory class mentioned above
to something else in WEB-INF/lib, then the context CL will work, and the
class CL will fail?

I am woefully ignorant of classloaders, so any explanations appreciated
:) Otherwise, a rule of thumb would do just fine.


--Jeff

> /LS

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to