This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Velocity Path not found

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have trying to make this work for a very long time. I have my templates in WEB-INF/templates. I am just trying to use it for email body generation.

I have this in the web.xml:

This is my servlet:

This is in my velocity.properties


When I execute it throws an exception
Exception: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/appname/WEB-INF/templates/helloworld.vm'

Thanks
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Justin,

I assume you're using Tomcat? If so then you can allow listDirectory and use your web browser to navigate to that file to make sure it's actually there. Also you need to check how the path lookups are occuring, are they relative to your context root? Absolute? Something else...?
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. Yes i am using Tomcat 6.
The templates are in the path /WEB-INF/templates. But the WEB-INF folder does not come up in the directory listing.
I am using the context-root to access the file.

Template t = Velocity.getTemplate("/appname/WEB-INF/templates/helloworld.vm");

Thanks.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic