cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: Potential Classloader bug
Date Mon, 06 Aug 2001 15:08:43 GMT
Sylvain Wallez wrote:
> 
> Shouldn't there be a mean in Avalon to store this "application root
> ClassLoader" and use it in selected places, like JDBC driver loading ?
> This will allow the JdbcDataSource <driver> to be loaded in the same
> ClassLoader as with the "force-load" parameter.

Cocoon stores the Application Root Classloader in each threads Context
Classloader so that we can execute the following snippet to get it:

Thread.currentThread().getContextClassLoader();

The issue with the JDBC driver was the the loadClass(name) function does
not resolve the class--which is essential to dynamically installing the
driver in the JDBC DriverManager.

I solved the problem by using the JDK1.2 (or is it 1.3 specific) method:

Class.forName(name, true, classLoader);

What this does is load a class with the specified classloader, and the
"true" parameter tells the ClassLoader to resolve the class.

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message