velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: newbie question - deploying sample servlet
Date Mon, 08 Apr 2002 18:08:12 GMT
On 4/7/02 9:36 PM, "Anmol Khanna" <anmol@radiocity.com.au> wrote:

> Hi,
> 
> I am trying to run the sample servlet example available with velocity build
> 1.0.1. 

You should upgrade to the latest release, 1.2.

> I get following error message when I access the servlet.
> 
> 
> java.lang.Exception: Cannot find the template!
> java.lang.Exception: Cannot find the template! at\

[SNIP]

> 
> Velocity log displays the following error message:
> 
> 
> Mon Apr 08 10:35:06 EST 2002 AvalonLogSystem initialized using logfile
> C:\Program Files\JabCreative\Tomcat\jakarta-tomcat-3.2.3\bin\velocity.log
> Mon Apr 08 10:35:06 EST 2002   [info]   [info] Default Properties File:
> org\apache\velocity\runtime\defaults\velocity.properties
> Mon Apr 08 10:35:06 EST 2002   [info] Resource Loader Instantiated:
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> Mon Apr 08 10:35:06 EST 2002   [info] FileResourceLoader : initialization
> starting.
> Mon Apr 08 10:35:06 EST 2002   [info] FileResourceLoader : adding path '.'

[SNIP]

> 
> I have placed the sample servlet (SampleServlet.class) and velocity files (
> sample.vm - used by SampleServlet and VM_global_library.vm)  in
> web-inf/classes folder of tomcat.
> 
> 
> The log says 
> " ResourceManager : unable to find resource 'VM_global_library.vm' in any
> resource loader"
> What location does the resource manager look for the velocity files ?
> 

Don't worry about the VM_global_library.vm message - that means that it is
trying to find your velocimacro library, if you had one, using a default
name, and it isn't there.  It's not a problem.

The problem that you *are* having is that Velocity isn't being configured to
find your template.  I know this because I see 'adding path '.' - that is
the default path (the 'current directory') and in a servlet environment, a
problem.

What you should do :

1) upgrade to the lastest Velocity

2) look at the sample servlet in examples/servlet_example2 - it has better
instructions on how to set things up, and it shows how to use either the
file resource loader with a template path relative to the webapp root, or
use the classpath resource loader.

geir

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
The question is : What is a Mahnamahna?


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


Mime
View raw message