incubator-yoko-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Hessellund Jensen <...@trifork.com>
Subject Class loading issues
Date Thu, 15 Jun 2006 07:40:23 GMT
The RMI test fail due to some class loading issues.

The problematic code is during marshalling of RMI values, where we 
obtain the helper class:

String name = value.getClass().getName() + "Helper";
// get the appropriate class for the loading.
ClassLoader loader = value.getClass().getClassLoader();
Class c = loader.loadClass(name);

Unfortunately, this fails. value may be any type, include e.g. String, 
in which case value.getClass().getClassLoader() returns null.

I'm wondering how to fix this. I suppose falling back to the ORBs 
classloader would work. Finally, the system class loader could be used.

String name = value.getClass().getName() + "Helper";
// get the appropriate class for the loading.
ClassLoader loader = value.getClass().getClassLoader();
if(loader == null) {
	loader = ORB.class.getClassLoader();
}
if(loader == null) {
	loader = ClassLoader.getSystemClassLoader();
}
Class c = loader.loadClass(name);

Perhaps someone with indsight into Geronimo class loading could comment 
on this?

Regards,
Anders

Mime
View raw message