View Single Post
  #1 (permalink)  
Old 05-18-2007, 12:52 AM
sandor sandor is offline
Member
 
Join Date: Apr 2007
Location: Pennsylvania,USA
Posts: 46
sandor is on a distinguished road
Velocity, cannot find resource
I have been fighting with Velocity for a day now. I think I have read every google page I found. Can anyone help?
I am using this in a web app. I have a template just under the /web/ directory and it cannot find it. It shows the actual path when I print it to the console but alas I am stumped.
Getting this error.
org.apache.velocity.exception.ResourceNotFoundExce ption: Unable to find resource 'testTemplate.vm'
Code:
Properties p = new Properties(); p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); p.setProperty("resource.loader", "templateName"); p.setProperty( "file.resource.loader.path", "/web/");//I have tried a lot of things here in this line Velocity.init(p); VelocityContext context = new VelocityContext(); template = Velocity.getTemplate(templateName);
Reply With Quote
Sponsored Links