You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Qureshi, Affan" <aq...@cars.com> on 2004/04/09 18:05:11 UTC

ResourceNoFoundException

Hi,
I am getting an exception try to call the mergeTemplate method using both the Singleton and seperate instance method. I have specified the absolute path for the template files and the path is valid (I can "less" the file on the filesystem). I have also tried giving relative paths as well (relative to the web-app root as well as relative to WEB-INF/classes).

Anybody has an idea what the problem could be?

I am running this on ATG Dynamo 6.2, Redhat Enterprise server.

Here is my code:
=================
		/* first, we init the runtime engine. */
            Velocity.init();
            templatePath = templateDir + "/" + templateName;

            /* Then make a Context and put data into it */
            VelocityContext context = new VelocityContext();
            addContextObjects(context, contextObjects);

            /* render a template */
            Velocity.mergeTemplate(
                    templatePath, DEFAULT_ENCODING, context, out);

And here is the exception i am getting: 
=======================================
*** ERROR      09 Apr 2004 10:56:26,844 -- siycom.utility.VelocityUtil -- Exception while processing velocity template for templatePath: /apps/cars/siy/docs/email/templates/PasswordReminderTemplate.xml
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/apps/cars/siy/docs/email/templates/PasswordReminderTemplate.xml'
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:501)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:384)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:814)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:796)
        at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:512)
        at siycom.utility.VelocityUtil.mergeTemplate(VelocityUtil.java:64)
        at siycom.email.builder.PasswordReminderBuilder.buildMessage(PasswordReminderBuilder.java:47)
        at siycom.email.MessageQueueListener.processMessage(MessageQueueListener.java:105)
        at siycom.utility.QueueReader.run(QueueReader.java:148)
        at java.lang.Thread.run(Thread.java:536)

Thanks a lot,

Affan

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: ResourceNoFoundException

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
Velocity is looking for

/apps/cars/siy/docs/email/templates/PasswordReminderTemplate.xml

where is the file?

On Apr 9, 2004, at 12:05 PM, Qureshi, Affan wrote:

> Hi,
> I am getting an exception try to call the mergeTemplate method using  
> both the Singleton and seperate instance method. I have specified the  
> absolute path for the template files and the path is valid (I can  
> "less" the file on the filesystem). I have also tried giving relative  
> paths as well (relative to the web-app root as well as relative to  
> WEB-INF/classes).
>
> Anybody has an idea what the problem could be?
>
> I am running this on ATG Dynamo 6.2, Redhat Enterprise server.
>
> Here is my code:
> =================
> 		/* first, we init the runtime engine. */
>             Velocity.init();
>             templatePath = templateDir + "/" + templateName;
>
>             /* Then make a Context and put data into it */
>             VelocityContext context = new VelocityContext();
>             addContextObjects(context, contextObjects);
>
>             /* render a template */
>             Velocity.mergeTemplate(
>                     templatePath, DEFAULT_ENCODING, context, out);
>
> And here is the exception i am getting:
> =======================================
> *** ERROR      09 Apr 2004 10:56:26,844 -- siycom.utility.VelocityUtil  
> -- Exception while processing velocity template for templatePath:  
> /apps/cars/siy/docs/email/templates/PasswordReminderTemplate.xml
> org.apache.velocity.exception.ResourceNotFoundException: Unable to  
> find resource  
> '/apps/cars/siy/docs/email/templates/PasswordReminderTemplate.xml'
>         at  
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(R 
> esourceManagerImpl.java:501)
>         at  
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Re 
> sourceManagerImpl.java:384)
>         at  
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance 
> .java:814)
>         at  
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance 
> .java:796)
>         at  
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java: 
> 512)
>         at  
> siycom.utility.VelocityUtil.mergeTemplate(VelocityUtil.java:64)
>         at  
> siycom.email.builder.PasswordReminderBuilder.buildMessage(PasswordRemin 
> derBuilder.java:47)
>         at  
> siycom.email.MessageQueueListener.processMessage(MessageQueueListener.j 
> ava:105)
>         at siycom.utility.QueueReader.run(QueueReader.java:148)
>         at java.lang.Thread.run(Thread.java:536)
>
> Thanks a lot,
>
> Affan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org