geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gianny DAMOUR" <gianny_dam...@hotmail.com>
Subject Re: [ClassLoader] What is the TCCL for Twiddle?
Date Wed, 01 Oct 2003 03:08:16 GMT
On Tue, 30 Sep 2003 22:21:04, Aaron Mulder said:
>
>	If I try the same calls via the normal Class.forName, they work,
>so the stuff is available on the "classpath", its just that the wrong TCCL
>is set.  It looks at a glance to be some sort of ClassWorlds CL, which is
>strange because I thought the whole point of ClassWorlds was to set up the
>*right* CL...
I am not sure if I understand really your issue. However, AFAIK classes 
should be loaded first from the ThreadContextClassLoader and if it is fails 
from the default class loader.

It means that to load a class dynamically, the first attempt should be:
Class clazz = 
Thread.currentThread().getContextClassLoader().loadClass(aClassName);
If it fails, one should try the standard classloader via the standard call:
Class clazz = Class.forName(aClassName)

BTW, it should be great to implement such an helper class.

For instance, I have written a Resource Adapter deployer, which configures 
amongst other things the ManagedConnectionFactories of an 
outbound-resourceadapter. To configure them, I use explicitely the 
ThreadContextClassLoader. This TCCL is a ClassSpace defines as the loader of 
my Resource Adapter deployer (this is done by configuring the MBeanMetaData 
related to the Resource Adapter deployer).

If you want, I can send you the source of this deployer as I will not submit 
a patch before 2 days.

Gianny

_________________________________________________________________
Hotmail : un compte GRATUIT qui vous suit partout et tout le temps ! 
http://g.msn.fr/FR1000/9493


Mime
View raw message