[
https://issues.apache.org/jira/browse/VELOCITY-778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914654#action_12914654
]
Rafał Miłecki commented on VELOCITY-778:
----------------------------------------
This was noticed long time ago by another user:
http://osdir.com/ml/jakarta.velocity.user/2002-03/msg00151.html
Workaround for this is to modify VelocityServlet to do something like:
String propsFile = config.getInitParameter(INIT_PROPS_KEY);
propsFile = getServletContext().getRealPath(propsFile);
It was also noticed and workarounded on:
http://www.utdallas.edu/~baughman/velocity.html#velload
> VelocityServlet.loadConfiguration(...) can not resolve propsFile, returns
> empty Properties
> ------------------------------------------------------------------------------------------
>
> Key: VELOCITY-778
> URL: https://issues.apache.org/jira/browse/VELOCITY-778
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.6.4
> Reporter: Rafał Miłecki
>
> My web.xml contains following code:
> <context-param>
> <param-name>properties</param-name>
> <param-value>WEB-INF/conf/velocity.properties</param-value>
> </context-param>
> I get following exception and backtrace:
> javax.servlet.ServletException: Error configuring the loader:
> java.io.FileNotFoundException: WEB-INF/conf/velocity.properties (No such file
> or directory)
>
> org.apache.velocity.servlet.VelocityServlet.init(VelocityServlet.java:213)
> pl.put.platon.common.PlatonServlet.init(PlatonServlet.java:173)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
> java.lang.Thread.run(Thread.java:636)
> There is following comment in VelocityServlet code:
> /*
> * This will attempt to find the location of the properties
> * file from the relative path to the WAR archive (ie:
> * docroot). Since JServ returns null for getRealPath()
> * because it was never implemented correctly, then we know we
> * will not have an issue with using it this way. I don't know
> * if this will break other servlet engines, but it probably
> * shouldn't since WAR files are the future anyways.
> */
> So the problem is that config.getInitParameter(INIT_PROPS_KEY) returns:
> WEB-INF/conf/velocity.properties
> which (path) doesn't work for Properties.load(...)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]