tomcat遇到过的异常!

第一个:

Could not find action or result
There is no Action mapped for namespace / and action name . -

意思是没有找到action 和结果

原因有二个:(1)就是配置出问题,也就是说表单的action和struts。xml的<action>标签的名字不相同,这出错了。

(2)你的访问地址出错:例如:http://heaven-c4e585e8:8080/week/ 但是我把web.xml的<welcome-file-list>
<welcome-file>login.jsp</welcome-file></welcome-file-list>删掉了,所以访问的地址为http://heaven-c4e585e8:8080/week/login.jsp

到底有没有其他原因我就不知道了!(这个问题弄了我一个星期,陈海文我不想活了!)



第二个:Dispatcher initialization failed Unable to load configuration. - action:/(什么盘什么的,一堆路径)什么什么的

原因有:(1)你导入的包的问题,如果你是用myeclipse自动导入的,你会出错,第一你导入了没必要的jar包,第二struts2.1以上的lib里面没有一个叫javassist-3.7.ga.jar的包。所以导入的7或者8个包就可以了!多了出错,少了也出错。还是不行的话解决的方案是:将tomcat自带的jdk版本该为我们安装的jdk,就可以了。



struts2-core-2.1.6.jar、
xwork-2.1.2.jar、
freemarker-2.3.13.jar、
ognl-2.6.11.jar、
commons-logging-1.0.4.jar、
commons-fileupload-1.2.1.jar、
commons-io-1.3.2.jar



其中 Caused by: Action class。。。。。。。。,我出错时因为我的类不在应该呆的地方,比如login的action类,我放错地方了!


第三:Exception starting filter struts2 Unable to load configuration

解决方案:

把commons-fileupload.jar 和 commons-io.jar 导入,结果错误解决了

由于类库中缺少:commons-fileupload-1.2.1.jar

注意刷新项目。

暂时遇到的异常和所解决的



第四个:(跟第二个差不多。就是一个词不一样)

Unable to load configuration. - interceptor-ref - file:/E:/place/myecllipse/.metadata/.me_tcat/webapps/week/WEB-INF/classes/struts.xml:10:47

一看异常就知道拦截器出现异常了, interceptor就是出错了

原因有:

看代码

<interceptors>
<interceptor name="loginInterceptor" class="com.heaven.action.interceptor.AuthorityInterceptior"></interceptor>
<interceptor-stack name="myinteceptor">
<interceptor-ref name="loginInterceptor"></interceptor-ref>
<interceptor-ref name="default-stack"></interceptor-ref>这里是defaultStack
</interceptor-stack>
</interceptors>

第五:严重: Servlet.service() for servlet jsp threw exception
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]


原因可能是:

(1)你没有配置web.xml或者你配置的不对。

(2)你访问地址不对了!你看看你是不是有namespace=“!!!!”而你在访问的时候没把!! !加上去!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值