velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: File Resource Loader "Unable to find resource " error for #parse files
Date Fri, 04 Jul 2008 02:52:56 GMT
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,  <Todd.McClintock@wellsfargo.com> 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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message