Peter, [EMAIL PROTECTED] wrote: > I'm still thinking that the loader path is the key to your problem; if it > were me I'd be experimenting with setting different likely values (such as > '/' or the webapp name). I'd also want to confirm that Velocity is actually > reading the right property file (I've been caught out by that one before, > where it was using default settings because my .properties wasn't in the > right place).
Velocity appears to be loading my velocity.properties file properly from WEB-INF/velocity.properties: 2008-10-06 11:55:47,282 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [info] VelocityViewServlet: Using custom properties at '/WEB-INF/velocity.properties' [snip] 2008-10-06 11:55:47,286 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [info] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl) 2008-10-06 11:55:47,290 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [info] Resource Loader Instantiated: org.apache.velocity.tools.view.servlet.WebappLoader 2008-10-06 11:55:47,290 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [debug] WebappLoader : initialization starting. 2008-10-06 11:55:47,290 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [info] WebappLoader : added template path - './' 2008-10-06 11:55:47,291 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [debug] WebappLoader : initialization complete. 2008-10-06 11:55:47,292 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [info] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl) 2008-10-06 11:55:47,292 [main] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/chadis]- Velocity [info] Default ResourceManager initialization complete. If I change the value for the template directory, I can see the change in the log file. This configuration has not changed since 2005-02-22 when it was initially committed to our CVS repository. Likewise, velocity-tools.jar has been stable since 2007-12-03. I don't understand why it doesn't work as written. If I change: webapp.resource.loader.path=. to: webapp.resource.loader.path=/ ... the app works as expected. I'll have to hack around with the WebappLoader to see what it thinks is the CWD (based on experience and typical webapp semantics, the webapp's deployment directory ought to be "."). > As I mentioned I usually jar up the templates, but before I started doing > that as a matter of course I'd put the templates under WEB-INF - that way > it makes it impossible for a client to request raw templates by name. I use Apache httpd out front, so I prohibit those requests via httpd configuration anyway. Thanks for the help everyone, -chris
signature.asc
Description: OpenPGP digital signature
