我正在使用 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/