I am using Spring MVC for my web application and I am integrating Velocity for templating my emails.
I am getting the following 500 error when It attempts to send my email.
org.apache.velocity.exception.ResourceNotFoundException:
Unable to find resource '/WEB-INF/velocity/registrationEmail.vm'
I am aware of what this means and what I need to do, but I know that I must be doing something wrong and I cant figure out why it cant find my .vm files.
I have configured velocity in my applicationContext.xml file as below, but I believe I might be leaving necessary properties out that Velocity needs to find the file.
<bean id="velocityEngine"
class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
</value>
</property>
</bean>
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
</bean>
I believe this might be where I need to make some changes/additions but I am not sure.
The path to my template files is WEB-INF/velocity/templateName.vm
I specify this when using the velocityEngine bean in my controller as well such as the following
String text = VelocityEngineUtils.mergeTemplateIntoString( velocityEngine, "/WEB-INF/velocity/registrationEmail.vm", test);
Is there something I need to do in my build.xml file to make sure that it is able to find my template files?