Howdy folks - Received a question from a colleague trying to load templates from the classpath (i.e. inside a jar in WEB-INF/lib) and getting: Unable to find resource errors.
I've been using the classpath resource loader in another project without problems, but not for the main template -- just the layout. I modified the velocity-tools layout example app to test. I see the same problem. :-( I made a jar with these two files and added to the Velocity Tools layout example: cptimo.vm -> "Howdy from inside the template.jar" layout/cplayout.vm -> "classpath layout $screencontent" http://localhost/layout/index.vm?layout=cplayout.vm -> works great http://localhost/layout/cptimo.vm -> fails: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/cptimo.vm' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Resour ceManagerImpl.java:458) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Resourc eManagerImpl.java:341) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java :831) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java :813) at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.ja va:285) at org.apache.velocity.tools.view.servlet.VelocityViewServlet.getTemplate(Unkno wn Source) ------ I'm running inside Tomcat 4.0.6, using the HEAD of velocity tools-examples-layout app. I had to add commons-logging.jar to get the servlet to init (Marino/Nathan -- is there a reason that isn't included?) I added the template.jar from above to WEB-INF/lib and this to the velocity.properties #--------------------------------------------------------------------------- - # RESOURCE loaders #--------------------------------------------------------------------------- - resource.loader = class, webapp # # ClasspathResourceLoader class.resource.loader.description = Velocity Classpath Resource Loader class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader # WebappResourceLoader webapp.resource.loader.description = Velocity Webapp Resource Loader webapp.resource.loader.class=org.apache.velocity.tools.view.servlet.WebappLo ader webapp.resource.loader.path=/WEB-INF/pages/,/ # Should be set to TRUE everywhere but LOCAL workstation webapp.resource.loader.cache=false ----------------- Any ideas? Thanks, Timo --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]