ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Preventing Parent Classloading
Date Thu, 09 Oct 2003 19:57:28 GMT
Sounds like the CL you create delegates to the Ant CL, thus your problem.
Create your own CL by making it delegate to the Root/Bootstrap CL (by
setting the parent loader to null), and the classes will always be loaded
from your classes (may duplicate-load the some classes Ant loaded in its CL,
but seems alright for you).

I'm no class loading expert, but at first glance this should work. --DD

> -----Original Message-----
> From: Upayavira [mailto:uv@upaya.co.uk]
> Sent: Thursday, October 09, 2003 2:39 PM
> To: dev@ant.apache.org
> Subject: Preventing Parent Classloading
> 
> I'm working on a CocoonTask. Cocoon has a significant bundle of jars,
> some of which overlap with Ant's.
> 
> In my task, I set up a class loader responsible for loading Cocoon
> classes, which works, apart from when those same classes exist in Ant,
> when the Ant ones are loaded instead of Cocoon's.Ant has a different
> version of org.apache.log.Hierarchy which is incompatible with the one
> in Cocoon, and thus resulting in an IllegalAccessError.
> 
> To quote from the javadocs for ClassLoader:
> 
> "When requested to find a class or resource, a ClassLoader instance will
> delegate the search for the class or resource to its parent class loader
> before attempting to find the class or resource itself. "
> 
> How can I reverse this, so that the Cocoon ClassLoader is used in
> preference? Or prevent the delegation to the parent class loader?
> 
> Thanks in advance.
> 
> Regards, Upayavira

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


Mime
View raw message