• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Velocity Path not found

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic