avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shash Chatterjee" <shash_l...@hotmail.com>
Subject Custom ClassLoader with Fortress
Date Thu, 07 Nov 2002 03:34:26 GMT
Hi,

I am trying to get Fortress to use a custom classloader (source attached).
The only difference from URLClassLoader is that I don't want to check the
parent classloader first to load the class.

This works fine with my test classes/packages.  However, when I use it with
Fortress, o.a.e.f.AbstractContainer#getComponentHandler gets a
NoSuchMethodException whenever it tries to get the constructor for
ThreadSafeComponentHandler.  I tried getting handlerKlass.constructors()[0]
explicitly, and in the debugger I see that it is the right constructor, with
the 6 correct parameter types.  But when the next line calls
newInstance(Object[] {....}), it gets a invalid parameter exception.

If I replace KeelURLClassLoader with URLClassLoader and change nothing else,
everything works fine.  If I use KeelURLClassLoader, but force it to get the
class from the parent classloader, then everything works fine.  The problem
happens whenever KeelURLClassLoder#findClass() is called!

I have been staring at this for two days and am at wit's end.....any help
would be much appreciated.

Thanks,
Shash

PS: If it makes a difference, here's how I am setting the loader.  I am
using the identical (system) classpath for both the parent and custom
class-loaders for the test.

ClassLoader loader = new KeelURLClassLoader(
                   new
URLClassLoaderPath(System.getProperty("java.class.path").getURLArray(),
                   ClassLoader.getSystemClassLoader());
contextBuilder.setContextClassLoader(loader);
containerManager = new DefaultContainerManager(
                    contextBuilder.getContext(), log);
containerManager.initialize();

Mime
View raw message