java - 部署 war 文件时无法实例化 VelocityEngine

标签 java tomcat tomcat6 velocity java-war

我正在使用 war 文件在 Tomcat 6 上部署应用程序。我在同一台机器上编译了供应商提供的源代码,然后将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 是什么或做什么。

最佳答案

这可能是因为 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)

关于java - 部署 war 文件时无法实例化 VelocityEngine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2694127/

相关文章:

java - 如何使用 printf -Java 将二维数组的所有元素排列成完美的表格

java - 为什么返回语句不执行?

java - 我的 Tomcat 应用程序可以在 Ubuntu 服务器上写入哪些文件夹

spring - Tomcat 与 Jetty JNDI 查找

java - 设置listview项目按钮加载特定url而不声明最终listview数据?

java - 如何在 Java 中断言异常?

apache - Hudson Apache SVN 结帐异常 - 500 内部服务器错误

tomcat - 使用 Jenkins 从 Maven 自动部署到 Tomcat 8

mysql - Oracle ADF - Tomcat 6.x - MySql 5.5 - java.lang.AbstractMethodError

java - 如何在tomcat servlet应用程序中打印日志