You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning Schmiedehausen (JIRA)" <de...@velocity.apache.org> on 2007/03/08 01:10:43 UTC
[jira] Closed: (VELOCITY-299) template not found under tomcat5
(wrong path)
[ https://issues.apache.org/jira/browse/VELOCITY-299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henning Schmiedehausen closed VELOCITY-299.
-------------------------------------------
> template not found under tomcat5 (wrong path)
> ---------------------------------------------
>
> Key: VELOCITY-299
> URL: https://issues.apache.org/jira/browse/VELOCITY-299
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.4
> Environment: Operating System: Linux
> Platform: PC
> Reporter: Oliver Scorp
> Assigned To: Velocity-Dev List
> Priority: Critical
>
> velocity can't find templates under tomcat5. after every try (including the
> velocity-examples) u'll get the following error-msg:
> "template not found org.apache.velocity.exception.ResourceNotFoundException:
> Unable to find resource 'mytemplate.vm'"
> after debugging the code i found some additional infos:
> the bug will be produced in the class "FileResourceLoader". This class use the
> variable "paths" which will not be correctly initialized. It contains always a
> "." as value insteed of the path to the actual webapp-directory. in the function
> "FileResourceLoader.findTemplate()" will this produce a wrong path to the template.
> ex.
> -----------------------------------------------------------
> private InputStream findTemplate(String path, String template){
> ...
> File file = new File(path, template); // here comes the error!
> String s = file.getAbsolutePath(); // maybe u add this line - it's better
> for debugging (... and/or adding this to the log)
>
> if (file.canRead())
> return new BufferedInputStream(new FileInputStream(s));
> else
> return null;
> ...
> }
> -----------------------------------------------------------
> cause the variable "path" contains "." the file will show to the
> working-directory of tomcat5 (ex: "[tomcat5]/bin/") and not to the webapp-directory
--
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