我们正在将Web应用程序从struts 2.3.16升级到2.5.13。我们使用Web sphere应用程序服务器(WAS 8.5)来运行,IDE是RAD。
我添加了所有必需的JAR文件,但是我收到了此错误
Error 500: javax.servlet.ServletException: Filter [struts2]: Could not find required filter class - org.apache.struts2.dispatcher.FilterDispatcher.class
当我检查新的Struts-core-2.5.13时,它不包含org.apache.struts2.dispatcher.FilterDispatcher.class
我已在web.xml
中更改过滤器,如下所示:
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
答案 0 :(得分:1)
过滤器org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
在Struts 2.5.x中不存在。
您应该使用org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
有关详细信息,请参阅
Changed filter package in Struts >= 2.5
As from Struts 2.5 all filters were moved to top package, see example:
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>