Hello,

Mike Janson wrote:
Hi there,

I'm not on the list, just new to Velocity and liking it a LOT--especially
the Struts implementation!  It really takes care of many of the problems
inherent in web designers trying to make sense of STRUTS tag-filled JSP
code.

Glad to hear it!


One question--I'm running into problems reading velocity (1.3) properties
in a WAR file.  When deploying in Tomcat 4.1/JBOSS 3, I get this error:

10:33:13,043 INFO [Engine] Unable to read Velocity configuration file:
java.io. FileNotFoundException: \velocity.properties (The system cannot
find the file specified)

I've run into similar problems with loading log4j properties in the past,
and found a similar issue in VelocityServlet::loadConfiguration():

        if ( propsFile != null )
        {
            String realPath = getServletContext().getRealPath(propsFile);

            if ( realPath != null )
            {
                propsFile = realPath;
            }

            p.load( new FileInputStream(propsFile) );
        }

From a WAR in Tomcat, getServletContext().getRealPath(...) returns *null*.
The appropriate way to load properties appears to be via getResource()
instead of getRealPath().

Correct. I was just going to suggest this be changed so velocity.properties is loaded that way along with toolbox.xml. The velocity.properties and toolbox.xml files could be located from /WEB-INF/classes. As a result, there would be no need to configure any paths in VelocityViewServlet which simplifies setup.


I would also suggest that toolbox.xml be renamed to velocitytoolbox.xml or velocitytools.xml.

-Bill


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to