部署struts2项目到Tomcat服务器中报错:Dispatcher initialization failed 以及 Tomcat 始终加载同一个项目的web.xml配置文件信息

严重: Dispatcher initialization failed
Unable to load configuration. - action - file:/E:/apache-tomcat-7.0.85/webapps/StrutsDemo/WEB-INF/classes/struts.xml:11:52
...
Caused by: Action class [gz.itcast.TestAction] not found - action - file:/E:/apache-tomcat-7.0.85/webapps/StrutsDemo/WEB-INF/classes/struts.xml:11:52
...
... 20 more
2018-5-16 21:53:03 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - action - file:/E:/apache-tomcat-7.0.85/webapps/StrutsDemo/WEB-INF/classes/struts.xml:11:52
...
Caused by: Unable to load configuration. - action - file:/E:/apache-tomcat-7.0.85/webapps/StrutsDemo/WEB-INF/classes/struts.xml:11:52
...
Caused by: Action class [gz.itcast.TestAction] not found - action - file:/E:/apache-tomcat-7.0.85/webapps/StrutsDemo/WEB-INF/classes/struts.xml:11:52
...
2018-5-16 21:53:03 org.apache.catalina.core.StandardContext startInternal
严重: One or more Filters failed to start. Full details will be found in the appropriate container log file
2018-5-16 21:53:03 org.apache.catalina.core.StandardContext startInternal
严重: Context [/StrutsDemo] startup failed due to previous errors

2018-5-16 21:53:03 org.apache.catalina.startup.HostConfig deployDirectory


解决:1)每次我部署的是其它的项目(比如struts2_3),但是错误信息中却说不能加载 StrutsDemo 的配置文件(StrutsDemo 是之前别的项目),同时我发现以前好使的struts项目突然都变得不好使了,显然是Tomcat的问题,直接卸载重新关联到MyEclipse上去即可
  2)如果不是Tomcat的问题,那么结合网上的答案,在struts.xml的Package标签中加入extends="struts-default"属性即可

猜你喜欢

转载自blog.csdn.net/zhouqj1913/article/details/80344820