You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by ml...@amsnet.com on 2001/02/15 16:36:55 UTC

Velocity w Tomcat Prob

 I am evaluating Velocity with servlets (using the Tomcat 3.2 servlet
 engine).

 I get the follwoing erro running the SampleServlet:
 Error processing the template
 Cannot find the template!

 The sample.vm file is in the same location as the SampleServlet.class file
 (under WEB_INF/classes).  Is this the wrong place?  Is there somewhere I
 have to config the template path?  Is there a Velocity/Tomcat setup
 wlakthrough anywhere?



Re: Velocity w Tomcat Prob

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
mlecza@amsnet.com wrote:
> 
>  I am evaluating Velocity with servlets (using the Tomcat 3.2 servlet
>  engine).
> 
>  I get the follwoing erro running the SampleServlet:
>  Error processing the template
>  Cannot find the template!
> 
>  The sample.vm file is in the same location as the SampleServlet.class file
>  (under WEB_INF/classes).  Is this the wrong place?  Is there somewhere I
>  have to config the template path?  Is there a Velocity/Tomcat setup
>  wlakthrough anywhere?


Take a look at the documentation on the site
http://jakarta.apache.org/velocity.


The upshot is that velocity must be configured to find the template.  
There is a property 
resource.loader.1.resource.path = <directory>

through which you can set where vel looks for the template.  The default
is the 'current directory', which for the servlet engine, is whatever
directory you were in when you started tomcat.

You can :

1) put the template in the current directory from where you start
tomcat.  This is the fastest way to see something, but a horrible
configuration approach :)

2) Make a file, velocity.properties, place it into the root directory of
your webapp, and put the property in there.  Then, follow the directions
in 

http://jakarta.apache.org/velocity/developer-guide.html

on how to work with servlets. The docs aren't spectacular, but should
give you a good idea. 

The velocity.log is also a great source for information - it will tell
you where the resource loader is looking to load templates.

good luck.  come back if you still have problems.  All of the vel
developers use Tomcat, so it certainly works well with Velocity. ;)

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity