velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <>
Subject Re: Unable to locate .VM files in Jar (Velocity 1.3.1)
Date Fri, 31 Oct 2003 22:21:59 GMT

On Friday, October 31, 2003, at 11:06 AM, Charles Oliver Nutter wrote:

> I suppose it could fall back on the getClass classloader if no context 
> classloader is available. It probably makes sense that environments 
> that don't manage classloader partitioning might not set the context 
> classloader...although I'm sure applications servers do--no way to 
> handle partitioning without it.

If that was the case, I'd do that.  The problem is that it's not 
yes-or-no.  if no thread in the chain since the primordial thread sets 
a context classloader, you get the classloader of the primordial 

We could probably do a check looking for the primoridal loader and make 
a decision then, but this really is kinda yecchy.

> You'd think it would be a simple add for Ant to set one, also. It does 
> have a couple levels of classloading, last I checked, and it probably 
> should be providing a context classloader the its threads...

They did it in 1.6

> - Charlie
> Geir Magnusson Jr. wrote:
>> On Friday, October 31, 2003, at 05:30 AM, Geir Magnusson Jr. wrote:
>>> On Thursday, October 30, 2003, at 08:14 PM, Charles Oliver Nutter 
>>> wrote:
>>>> Let me know if you need any help!
>>>> Seriously though, it wouldn't be a bad idea to put this in place 
>>>> wherever ClassLoader is used; for example, in locating 
>>>> ResourceLoader instances. As it is, I created my own 
>>>> ThreadContextResourceLoader so I could load from a jar in an EJB 
>>>> container...but I had to put that classloader in a jar at the same 
>>>> level as the Velocity jar (system-wide). An app should be able to 
>>>> configure resource loaders that might only exist in its context 
>>>> classloader.
>>>> I'm sure there's other places also.
>>> You're exactly right.  It's a simple change so we can see where else 
>>> we have it.
>>> It did break a texen test case, so I'm chasing that down now.  
>>> Started last night, but decided it was time to carve pumpkins for my 
>>> 5 month old.  I had fun - seems like at that age, it's mostly for 
>>> the parents.  She didn't give a hoot, other than trying to lick one. 
>>>  I guess a big orange vegetable is good for that at that age.
>> Hoo boy.  Here's the beef.  Ant doesn't set the context classloader
>> so Thread.currentThread().getContextClassloader()
>> return the primordial classloader, which of course, doesn't have the 
>> classpath that you set in the ant build script.  I you use the 
>> canonical
>> this.getClass().getClassloader()
>> you get the ant classloader, which has your classpath.
>> I'm asking the ant crew about what to do.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Geir Magnusson Jr                                   203-247-1713(m)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message