ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Clark <robert.cl...@quest.com>
Subject Re: SystemClassLoader fails to load inside my own ant task
Date Thu, 20 Apr 2006 17:09:00 GMT
On Tuesday April 18, 2006 17:20, Marcel Ruff 
<Marcel.Ruff@avitech-ag.com> wrote:
> ...
>
> The java.util.logging.LogManager.java uses following code:
>
>   Class clz = ClassLoader.getSystemClassLoader().loadClass(word);
>
> It seems the system class loader does not find my XbNotifyHandler
> class even that it is definitely in the CLASSPATH,
> i have also tried
>   <typedef >
>   <classpath> <pathelement location="..."
>
> with no success.
>
> But this is works fine:
>   Class clz =
> Thread.currentThread().getContextClassLoader().loadClass(cname);
>
> but i can't change the java.util.logging code to use the
> ContextClassLoader!
>
> How can i resolve this issue?

Ant loads classes and tasks using it's own classloader. If the 
java.util.logging code need to load a class using the system 
classloader, then the only way I know of to arrange this is to add it 
to the CLASSPATH environment variable *before* starting Ant.

I'd suggest you also consider filing a bug with Sun about this. there 
are some places in LogManager.java where they try the System 
classloader and then fall back on the context classloader and some 
places they do not. I don't see any reason not to fall back to the 
context classloader in all cases. This would allow the java.util 
logging to work with Ant as well.

- Rob


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


Mime
View raw message