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 Thu, 30 Oct 2003 22:03:20 GMT
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.loader.ClasspathResourceLoader
>file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoader
>file.resource.loader.path=./templates, templates, /templates,
>/com/company/tool/generator/templates
>jar.resource.loader.class=org.apache.velocity.runtime.resource.loader.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


Mime
View raw message