ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <ge...@optonline.net>
Subject Re: Baffled in classloader land
Date Fri, 31 Oct 2003 16:08:28 GMT

On Friday, October 31, 2003, at 10:50 AM, Stefan Bodewig wrote:

> 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.

I thought about that, but was scared that would simply mask a problem - 
if you failed to put the resource for your app in the right place, and 
there was old/wrong/different resources in the root classloader, you 
would mask your problem and possibly expose information 
inappropriately....

geir

>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


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


Mime
View raw message