velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <ge...@optonline.net>
Subject Re: Unable to locate .VM files in Jar (Velocity 1.3.1)
Date Fri, 31 Oct 2003 10:30:17 GMT

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.

geir

>
> - Charlie
>
> Geir Magnusson Jr. wrote:
>
>> I'm going to fix that right now.  Been meaning to.  it seems like the  
>>  right thing to do, and I can't think of a reason why not.
>>
>> geir
>>
>> On Thursday, October 30, 2003, at 05:03 PM, Charles Oliver Nutter  
>> wrote:
>>
>>> 1. Specify the full path to the template. If it's contained within a  
>>>  jar in the path my/path/to/template, you'd prepend that path to the  
>>>  name of the template file.
>>> 2. If you are loading Velocity in one classloader (like at the  
>>> system  level) and trying to access the template within another  
>>> classloader  (like at the EJB container level) you'll need to  
>>> implement your own  ClasspathResourceLoader that uses   
>>> Thread.currentThread().getContextClassLoader() instead of   
>>> getClass().getClassLoader(). There's a bug on this at
>>>
>>> http://issues.apache.org/bugzilla/show_bug.cgi?id=22419
>>>
>>> - Charlie
>>>
>>> jenfield@Guardian.com wrote:
>>>
>>>> I have a project setup in JBuilder With a structure that looks   
>>>> something
>>>> like this:
>>>>
>>>> com.company.tool.generator
>>>>  -contains class files
>>>> com.company.tool.generator.templates
>>>>  -contains all the .VM Files
>>>> com.company.tool.generator.properties
>>>>  -contains properties files
>>>>
>>>> I create a runnable jar by including the above, plus the entire   
>>>> velocity
>>>> package (with dependencies).
>>>>
>>>> However,
>>>> The program is unable to locate the .VM Files.
>>>>
>>>> I've tried varies setting for the resource loader - including the
>>>> following:
>>>>
>>>> resource.loader=classpath, file,jar
>>>> classpath.resource.loader.class=org.apache.velocity.runtime.resource 
>>>> .l oader.ClasspathResourceLoader
>>>> file.resource.loader.class=org.apache.velocity.runtime.resource.load 
>>>> er .FileResourceLoader
>>>> file.resource.loader.path=./templates, templates, /templates,
>>>> /com/company/tool/generator/templates
>>>> jar.resource.loader.class=org.apache.velocity.runtime.resource.loade 
>>>> r. JarResourceLoader
>>>> jar.resource.loader.path=jar:file:templates.jar
>>>>
>>>> templates.jar was another attempt - but the VM files are located in  
>>>>  the
>>>> com/company/tool/generator/templates path - so Velocity is unable  
>>>> to  find
>>>> them.
>>>>
>>>> It seems the only way I can get to my Template (VM) files is if I   
>>>> move them
>>>> out of the jar where the 'file' resource can see them, or put them  
>>>> in  the
>>>> root of my jar - which is really messy.
>>>>
>>>> Could the jar resource loader be extended so something like this:
>>>> jar.resource.loader.path=jar:file:templates.jar/com/company/tool/  
>>>> generator/templates
>>>> could happen?
>>>>
>>>> or is there another way to accomplish what I'm looking for?
>>>>
>>>> Thank you,
>>>> JoeE
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> This communication may contain information that is legally   
>>>> privileged, confidential, or exempt from disclosure.  If you are  
>>>> not  the intended recipient, please note that any dissemination,   
>>>> distribution, or copying is strictly prohibited.  If you have   
>>>> received this message in error please notify the sender by  
>>>> telephone,  fax, or return email and delete this message from your  
>>>> computer.   Thank you.
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail:  
>>>> velocity-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:  
>>> velocity-user-help@jakarta.apache.org
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


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