velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Oliver Nutter <head...@headius.com>
Subject Re: Unable to locate .VM files in Jar (Velocity 1.3.1)
Date Fri, 31 Oct 2003 16:15:37 GMT
On second read I see the problem...the context classloader always 
returns something, but if the thread creator doesn't change it, it's not 
the correct one.

Yeah, I'd think this is definitely not correct behavior...if you're 
creating/managing threads that have specially configured classloaders, 
you should be setting context classloaders for them...

The ClasspathResourceLoader could try both classloaders, as a short-term 
measure...

- 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: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message