ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Baffled in classloader land
Date Fri, 31 Oct 2003 15:50:23 GMT
On Fri, 31 Oct 2003, Geir Magnusson, Jr. <geirm@optonline.net> wrote:

> This just makes me worried about changing the resource loader in
> Velocity, because it will probably bite us elsewhere

Yes, and I don't think you can expect applications to set the context
classloader all the time.  If you look at the Javadocs of
Thread.getContextClassloader it says 

,----
| The context ClassLoader of the primordial thread is typically set to
| the class loader used to load the application.
`----

which is not a very strong statement.  "typically".  Honestly, I've
never thought about setting the context classloader in stand-alon apps
of mine.

I've just had a short look into commons-discovery.  They search the
thread context classloader and getClass().getClassloader().  At least
that's my understanding of ServiceDiscoveryTask.  So maybe you should
fall back to your class's classloader if a resource cannot be loaded
via the context classloader.

Stefan

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


Mime
View raw message