【问题标题】:Unable to instantiate VelocityEngine, when deploying war file部署war文件时无法实例化VelocityEngine
【发布时间】:2010-04-22 20:12:46
【问题描述】:

我正在 Tomcat 6 上部署一个应用程序,使用一个 war 文件。我已经在同一台机器上编译了供应商提供的源代码,然后将 war 文件移动到 {tomcat-home}/webapps/

当我启动应用程序时,我看到一条错误消息:

The SystemInformationService could not be retrieved from the container. Therefore very limited information is available in this error report. 
The SystemInformationService could not be retrieved due to the following error: java.lang.IllegalStateException: Spring Application context has not been set
Cause
java.lang.RuntimeException: Unable to instantiate VelocityEngine!
    at com.opensymphony.webwork.views.velocity.VelocityManager.newVelocityEngine(VelocityManager.java:333)

Stack Trace:[hide]

java.lang.RuntimeException: Unable to instantiate VelocityEngine!
 at com.opensymphony.webwork.views.velocity.VelocityManager.newVelocityEngine(VelocityManager.java:333)
 at com.opensymphony.webwork.views.velocity.VelocityManager.init(VelocityManager.java:146)
 at com.opensymphony.webwork.dispatcher.VelocityResult.doExecute(VelocityResult.java:61)

我在另一台机器上按照相同的步骤安装了它。

我不明白错误告诉我什么。

我会丢失 jar 文件吗? (但它编译得很好)。

我忘记设置环境变量了吗?

我不知道该怎么做,我不知道 VelocityEngine 是什么,或者做什么。

【问题讨论】:

  • 我发现当我将 server.xml 更改为包含 unpackWARs="true" 时,现在它可以正常工作了

标签: java tomcat tomcat6 velocity java-war


【解决方案1】:

这可能是因为 Velocity 的日志记录试图记录到只读文件夹,甚至是 jar 文件。

* create a file "velocity.properties" and place it in the WEB-INF/classes folder.
* Inside the file, write

runtime.log.logsystem.class=org.apache.velocity.runtime.log.NullLogSystem

(见here原文)

【讨论】:

  • 奇怪的是我已经将它作为一个未爆炸的 WAR 文件部署在 Jboss 上并且它工作正常。我需要在 Tomcat 中解压 WAR 以使其正常工作。
猜你喜欢
  • 2019-11-02
  • 1970-01-01
  • 2014-02-01
  • 2017-08-29
  • 2012-09-28
  • 2016-04-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多