Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Loading Velocity template

843842Dec 14 2005 — edited Jan 3 2008
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2008
Added on Dec 14 2005
11 comments
9,639 views