struts报错严重: Dispatcher initialization failed Unable to load configuration.

来源:互联网 发布:mac tomcat端口被占用 编辑:程序博客网 时间:2024/06/06 08:30

在使用struts编程时出现下例错误,总结网上解决方法,汇总如下


严重: Dispatcher initialization failed

Unable to load configuration.

报上面错误的原因有多种,得看后面提示是什么原因引起的,再动手


解决。

*****************************************

情况一:

严重: Dispatcher initialization failed

Unable to load configuration. - action - file:/D:/Program

%20Files/Tomcat7.0/webapps/sshtest1/WEB-

INF/classes/struts.xml:8:83

......

Caused by: Action class [com.lib.action.Loginactionr] not 

found 

上面说struts.xml第8行出现错误,看后面提示说是Action class找

不到,


解决方法1:查看struts.xml中的第8行代码,看看类的包或类名是否

正确


解决方法2:在项目名处右键->build path->configure Build 

Path...->Libraries 

看看有没有打错标记的包


解决方法3:有时因不明原因造成服器上的文件没有更新,引起报同

样的错误。所以将项目从Tomcat服务器从删除,并重新发布到Tomcat

服务器上。


解决方法4:打开服务器查看相关的文件在不在,如文件

[com.lib.action.Loginaction]中的Loginaction在不在服务器对应

的文件夹内;

***********************************************

情况二:

严重: Dispatcher initialization failed

Unable to load configuration. - bean - jar:file:/D:/apache-

tomcat-6.0.29/webapps/myKj/WEB-INF/lib/struts2-spring-

plugin-2.1.8.1.jar!/struts-plugin.xml:29:132


说明错误在struts-plugin.xml的第29行

解决方法:

这个是因为多加了struts2-spring-plugin-2.1.8.1.jar,这个包,

没有用到spring的时候不要加。删掉

****************************************************

情况三:

严重: Dispatcher initialization failed

Unable to load configuration. - bean - jar:file:/C:/Program 

Files/Apache Software Foundation/Tomcat 

6.0/webapps/Struts2Demo01/WEB-INF/lib/struts2-core-

2.1.8.jar!/struts-default.xml:47:178


解决方法:

除了

commons-logging-1.0.4.jar

freemarker-2.3.12.jar

ognl-2.6.11.jar

struts2-core-2.1.2.jar

xwork-2.1.1.jar

这五个核心LIB要复制外,

commons-io-1.3.2.jar

commons-fileupload-1.2.1.jar

这两个Jar文件也必须放到指定目录


*************************************

错误总结

1.使用了没有用到的包;

2.struts2.xml 配置文件中类的名称(包名+类名)错误;

3.服务器中的配置文件没有更新,还是以前错误的文件;

4.服务器中没有相应的文件;

5.相关的包没有导入项目中;

阅读全文
0 0
原创粉丝点击