avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject RE: Custom ClassLoader with Fortress
Date Thu, 07 Nov 2002 04:44:36 GMT
> From: Shash Chatterjee [mailto:shash_list@hotmail.com] 
> 
> 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.



The problem has to do with the fact that you altered the contract
for ClassLaoders.  By not allowing the delegation to the parent (or
even resolving first), the class in question is not treated as equal
to one in the parent classloader--even if they come from the same
JAR file.

The short solution is to not make that modification to the classloader
contract--which Fortress was counting on.  The longer solution is to
modify Fortress to use the ClassLoader that loaded the container classes
to load the handler classes.  The custom classloader would be used
for your class specifically.

However, that may not work because of the need to resolve things like
Configuration, Context, etc.  All of these need to come from the same
classloader.


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message