2013-04-22 98 views
-1

因此,这是交易。速度资源路径的问题

我正在使用Spring Framework开发预约应用程序。

一切都得不错本地主机甚至邮件发送部分

但是当我通过这个项目对我weblogic的,则resource.loader.path属性出现不加载。

这里是我的代码的重要组成部分:

Properties prop = new Properties(); 
prop.setProperty("resource.loader", "class"); 
prop.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); 
prop.setProperty("class.resource.loader.path", "../jsp/email-templates"); 

VelocityEngine.init(prop); 
Template template = VelocityEngine.getTemplate("user-response.jsp"); 

正如我所说的,只是我的代码的重要组成部分。基本上这样配置属性对象VelocityEngine.getTemplate()加载上述文件夹内的user-response.jsp文件。

正如我所说的,在我的本地主机,他只是工作正常,但在weblogic出现这样:

org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '..nulluser-response.jsp' 

出于某种原因,class.resource.loader.path财产不加载weblogic

那么......有人已经经历过这个问题?什么是错的任何想法?

实验值:这两个项目(本地主机和WebLogic)是相同的,使用版本控制软件(集市)

回答

1

我建议使它相对于CLASSPATH。如果您将/ email-templates文件夹放在WEB-INF/classes下,并将加载路径设置为“email-templates”,它应该可以工作。

+0

它不适合我。已经做到了:( – Alexandre 2013-04-22 16:57:08

+0

是的,这意味着你不知道CLASSPATH是如何工作的。将Velocity JAR放入WEB-INF/lib中。 – duffymo 2013-08-02 10:02:31