Hi,
I have a batch application that is using velocity create the content for
emails.
I keep getting an "" when trying to merge a template that contains a
"#parse" statement. I don't have this problem on a Web Application that
uses an identical Spring Context Config to create a velocity bean.
Questions:
1. How do I figure where velocity is looking for the file reference by
the #parse statement? If I knew where velocity expects to find it I can
fix the problem.
2. The Velocity User Guide says that files referenced by #parse must be
under the TEMPLATE_ROOT directory. How do I sent the TEMPLATE_ROOT
directory? How do I determine the location of the TEMPLATE_ROOT
directory when my application is up and running?
Thanks
Todd McClintock
Details:
mergeTemplate method call and error
##############################################
velocityEngine.mergeTemplate("VelocityTestTemplate.vm", velocityContext,
writer);
SEVERE: #parse(): cannot find template '/commom.vm', called from
template VelocityTestTemplate.txt at (1, 1)
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource '/commom.vm'
##############################################
VelocityTestTemplate.vm
##############################################
#parse ( "commom.vm" )
Hello $name
Today is $day.
##############################################
common.vm
##############################################
#set ( $day = "Thursday" )
##############################################
Spring Context File used to configure Velocity
##############################################
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<bean id="notificationVelocityEngine"
class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<props>
<prop key="resource.loader">file</prop>
<prop
key="file.resource.loader.class">org.apache.velocity.runtime.resource.lo
ader.FileResourceLoader</prop>
<prop
key="file.resource.loader.path">C:\velocityTest</prop>
<prop
key="file.resource.loader.cache">true</prop>
<prop
key="file.resource.loader.modificationCheckInterval">0</prop>
</props>
</property>
</bean>
</beans>
##############################################