在Eclipse IDE进行Struts开发时提示错误:java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDi...

If you have...

  1. included all necessary jars
  2. Configured build path correctly
  3. added them all in deployment assembly
    Correctly.

then also you getting "java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher" error then you could be doing below things wrong.

solution:

check your struts2-core-x.x.jar version.

-->if it is struts2-core-2.5.jar then change your filter class tag value in web.xml to

<filter-class>
     org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
</filter-class>

-->if it is struts2-core-2.1.3.jar then change your filter class tag value in web.xml to

<filter-class>
     org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>

FilterDispatcher is deprecated since Struts 2.1.3. If you are working with older versions then user above solution.

-->if it is struts2-core-2.3.X.jar then change your filter class tag value in web.xml to

<filter-class> 
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>

Reason behind all this is struts 2 controllers are placed in different location in different version of struts2-core jar and some time they are called by different name as you can see in 2.1.3.

Thank you!

需要注意的是:

  在struts2.1版本之前,所使用的核心过滤器类是 org.apache.struts2.dispatcher.FilterDispatcher,从struts2.1版本之后,已经不推荐使用,而是使用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter类。但是当struts版本发展到2.5之后的版本时,推荐将类完全名称中的ng去掉,即使用org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter类。

转载于:https://www.cnblogs.com/rainbow70626/p/11161144.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值