org.apache.velocity.exception.ResourceNotFoundException [英] org.apache.velocity.exception.ResourceNotFoundException
问题描述
我收到错误: org.apache.velocity.exception。 ResourceNotFoundException
当我尝试发送邮件。
我已经包括velocity1.5.jar,mail.jar,activation.jar,smtp.jar
我在这里包含速度模板路径
String velocityTemplate =mailTemplate / sendMail.vm;
,mailTemplate文件夹位于 WEB-INF / classes
文件夹
当代码执行此行时,我收到该错误
模板模板= speedEngine.getTemplate(velocityTemplate);
可以帮助我吗?
正如BenM所说,我们必须将资源加载程序配置为ClasspathResourceLoader
velocityEngine.setPr operty(resource.loader,class);
velocityEngine.setProperty(class.resource.loader.class,org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader));
velocityEngine.init();
我刚刚添加了最新版本的以下jar。现在它正常工作。
- > commons-collections-3.2.1.jar
- > commons-lang-2.4.jar
再次感谢BenM
I am using velocity engine template for mailing in struts1 and hibernate configuration.
I got error: org.apache.velocity.exception.ResourceNotFoundException
while I try to send mail.
I have included velocity1.5.jar, mail.jar, activation.jar, smtp.jar.
I include the velocity template path here
String velocityTemplate = "mailTemplate/sendMail.vm";
and the mailTemplate folder is in WEB-INF/classes
folder
I got that error when code executes this line
Template template = velocityEngine.getTemplate(velocityTemplate);
can any one help me regarding this?
It will be more appreciable if any one help me.
As BenM said we have to configure the Resource Loader as a ClasspathResourceLoader
velocityEngine.setProperty("resource.loader", "class");
velocityEngine.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"));
velocityEngine.init();
and I just added the latest version of the following jar. now it's working properly.
--> commons-collections-3.2.1.jar
--> commons-lang-2.4.jar
once again Thanks BenM
这篇关于org.apache.velocity.exception.ResourceNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!