【发布时间】:2012-01-15 07:11:43
【问题描述】:
我有一个使用 Struts2 和 Spring 为 DI 编写的应用程序,并且我使用 Tomcat 6 作为容器。假设我在 Tomcat 上部署后将应用程序打包为 my-application.war,我可以通过 http://my-host/my-application 访问它。
当我删除 .war 文件时,Tomcat 应该取消部署应用程序,根据here 当我尝试http://my-host/my-application 时,我应该得到:
HTTP Status 404
但我得到了:
HTTP Status 503 - This application is not currently available
当我将应用程序重新部署到相同的上下文路径时,我得到一个奇怪的异常:
Unable to instantiate Action, [ActionClass], defined for '' in
namespace '/' Failed to convert value of type [MyClass] to required type
[MyClass] for property 'myClass': no matching editors or conversion strategy
found
其中 ActionClass 具有 MyClass 类型的属性 myClass,该属性由 Spring 注入,默认为单例。这很奇怪,因为两个对象的类型相同。我怀疑应用程序一开始并没有完全取消部署,因为当我重新启动 Tomcat 时,场景会重复。我将不胜感激找到可能的原因。
【问题讨论】:
标签: spring tomcat struts2 tomcat6