velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Ehrmann <ehrm...@gmail.com>
Subject Can't get WebappResourceLoader to load
Date Thu, 11 Mar 2010 21:13:25 GMT
I'm having problems getting Templates from a WAR file to load.  Thanks to my
debugger, I traced it down to not seeing WebappResourceLoader in the
VelocityEngine's internal resource loader list; all I saw was a
FileResourceLoader.

Here's how I'm initializing Velocity:

In my Servlet's init() method, I do:

ve = new VelocityEngine();
ve.setApplicationAttribute("javax.servlet.ServletContext",
this.getServletContext());
ve.init();

I tried setting the attribute both before and after init.  No change.

My web.xml file has the servlet defined like this:

<servlet>
<servlet-name>mySite</servlet-name>
<servlet-class>...mySite</servlet-class>
   <init-param>
     <param-name>org.apache.velocity.properties</param-name>
     <param-value>/WEB-INF/velocity.properties</param-value>
   </init-param>
</servlet>

When I look at .../TomcatRoot/webapps/ROOT/WEB-INF/velocity.properties, it
exists.

And my velocity.properties file:

resource.loader=webapp
webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader
webapp.resource.loader.path=/WEB-INF/templates/

directive.foreach.counter.initial.value = 0

Am I missing a step?  Did I get the initialization order right?  I couldn't
find WebappResourceLoader, so after some searching, I saw that it was in
Velocity Tools...until I realized it also wasn't in there, so I switched
to velocity-tools-view-2.0-beta4.jar.  Velocity is velocity-1.6.3.jar.

Thanks in advance,

David

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message