velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Townson <>
Subject Re: javax.servlet.jsp.JspException: Error initializing Velocity: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'menu.vm'
Date Mon, 06 Aug 2007 19:14:23 GMT
>>> On 8/2/07, nageshyakkanti <> wrote: Hi,
>>> my is as follows resource.loader = classpath
>>>  file.resource.loader.description = File Resource Loader 
>>> file.resource.loader.class =
>>> org.apache.velocity.runtime.resource.loader.FileResourceLoader 
>>> file.resource.loader.path = /templates
>> Nathan Bubna wrote: The FileResourceLoader is notoriously difficult
>> to configure property in a webapp environment, and is impossible to
>> use in a webapp run as an unexploded WAR file.
>> I recommend looking into the WebappLoader that is part of the 
>> VelocityTools project.  You can see the VelocityTools javadoc or 
>> search these mail archives for more info on it.
> nageshyakkanti wrote: I am using an exploded war file in this.

my understanding of the use and purpose of the FileResourceLoader is
that it really comes into its own when your templates are not stored as
part of your webapp at all.

For instance, we use it because our templates are developed entirely
separately from any webapps and stored in a "document root". This is, in
fact, an Apache HTTPD docroot (httpd being used to serve static files
from this, such as *.css, *.js etc).

It is very useful for this purpose, but requires the specification of an
absolute file path URI to the resource root (i.e. the docroot), which is
a environment-specific setting and cannot be defined relative to the
webapp itself. In other words, your properties file which specifies:

file.resource.loader.path = /templates

... would instead need to specify:

file.resource.loader.path = /path/from/root/to/templates

If you do not require this separation between webapp and templates
(which it sounds as though you do not), then Nathan's suggestion that
you use the WebappResourceLoader is correct ... it is similar to the
FileResourceLoader, but your application-relative template path would
work with that.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message