Nathan, Thanks for the quick response. That was the problem.
Regards Todd -----Original Message----- From: Nathan Bubna [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 7:53 PM To: Velocity Users List Subject: Re: File Resource Loader "Unable to find resource " error for #parse files i'm not sure if it's just a typo in your email or if it's a problem in your actual template, but you said you are trying to do: #parse( 'commom.vm' ) and have it find a "common.vm" template. is it as simple as changing it to #parse( 'common.vm' ) ? On Thu, Jul 3, 2008 at 7:14 PM, <[EMAIL PROTECTED]> wrote: > 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> > > ############################################## > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
