Greetings,
I am having great difficulty loading a Velocity template inside my JSF application. This is how I am doing it:
Properties p = new Properties();
p.setProperty( "file.resource.loader.path", "/WEB-INF/templates" );
Velocity.init(p);
Template template = Velocity.getTemplate( "report_email_html.vm" );
Here's the stack trace:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'report_email_html.vm'
at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:458)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:341)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:831)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:813)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:285)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:469)
at com.gofastcash.client.ReportGenerator.buildReport(ReportGenerator.java:102)
at com.gofastcash.client.ReportGenerator.run(ReportGenerator.java:46)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
java.lang.NullPointerException
at com.gofastcash.client.ReportGenerator.buildReport(ReportGenerator.java:131)
at com.gofastcash.client.ReportGenerator.run(ReportGenerator.java:46)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
What am I doing wrong? I have tried every combination of paths, slashes both forward and back, and checked for typos.
Many thanks,
David