You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Rafał Miłecki (JIRA)" <de...@velocity.apache.org> on 2010/09/24 23:26:32 UTC

[jira] Commented: (VELOCITY-778) VelocityServlet.loadConfiguration(...) can not resolve propsFile, returns empty Properties

    [ https://issues.apache.org/jira/browse/VELOCITY-778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914655#action_12914655 ] 

Rafał Miłecki commented on VELOCITY-778:
----------------------------------------

Other, ugly workaround is to put full path in web.xml. This is however not acceptable for project developed by few developers in different environments.

> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org