0 Replies Latest reply on Dec 11, 2014 5:27 AM by mauro.brasil

    Velocity ClasspathResourceLoader don't work on JBoss7

    mauro.brasil

      Hello there!

       

      I have an application "*.war" that I've ported from "jboss-4.2.3.GA" to "jboss-as-7.1.1.Final".

      Until yesterday I was using FileResourceLoader on Velocity configuration to access the templates and everything was ok; but, when I've changed to ClassResourceLoader, the velocity templates could not be found any more.

       

      It's the same configuration that works pretty fine on "jboss-4.2.3.GA".

       

      I've found lots and lots of posts about similar issues but all indicating to place everything under "WEB-INF\lib" or "WEB-INF\classes" folders, or how to add an external path to classpath, but I want to keep the original WAR structure that is:

       

      WAR-FILE-ROOT

         css

         images

         js

         META-INF

         templates

         WEB-INF

       

      So, I think the question should be: How can I add internal WAR paths to ClassPath so the application can work the same way as on "jboss-4.2.3.GA"?

       

      Just one note.

      I've extended the original "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" implementation just to receive the templates path value "templates/" to be prepended before every call to "getResourceStream" method.

       

      Thanks and best regards,

      Mauro.