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类。

在Eclipse IDE进行Struts开发时提示错误:java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher的解决办法的更多相关文章

  1. 第一次部署Struts2时出现错误java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.class

    报如下错误 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org. ...

  2. java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter /struts2.1.3以前版本和之后版本区别/新版Eclipse找不到Java EE Module Dependencies选项

    严重: Exception starting filter struts2java.lang.ClassNotFoundException: org.apache.struts2.dispatcher ...

  3. IDEA调试SpringMvc项目时,出错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener,解决办法

    具体报错信息如下图所示: 解决方法:File > Project Structure > Artifacts > 在右侧Output Layout右击项目名,选择Put into O ...

  4. IE浏览器下载文件保存时提示:“你没有权限在此位置中保存文件”解决办法

    E浏览器下载文件保存时提示 解决办法: 1.Win + R,打开运行命令,输入gpedit.msc,如图所示 2.打开计算机本地组策略编辑器:选择计算机配置-windows设置-安全设置-本地策略-安 ...

  5. mysql数据库导入sql文件时提示“Error Code: 1153 - Got a packet bigger than 'max_allowed_packet' bytes”解决办法

    向mysql数据库中导入sql文件时,如果文件过大(几百M),会提示"Error Code: 1153 - Got a packet bigger than 'max_allowed_pac ...

  6. usb设备(移动硬盘或U盘),弹出时提示“有进程或程序占用,无法弹出”。解决办法

    测试环境:Win7(其他Windows系统环境,也可参考) 总结办法来源,https://bbs.csdn.net/topics/392297251?page=1文章中热心网友的评论指引 1. 控制面 ...

  7. 已解决: idea创建并部署SpringMVC项目时 报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    用IDEA创建并运行SpringMVC项目时,最初发现没有Servlet包,这个问题已在上篇解决,然而当我们尝试去运行此时的SpringMVC项目时,发现仍然有错误.ClassNotFoundExce ...

  8. eclipse中部署web项目时报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener的解决方法

    解决方案: 1.右键点击项目--选择Properties,选择Deployment Assembly,在右边点击Add按钮,在弹出的窗口中选择Java Build Path Entries 2.点击N ...

  9. Androidstudio预览时出现错误java.lang.NoClassDefFoundError: com/android/util/PropertiesMap

    参考博客;http://blog.csdn.net/daqi1983/article/details/51474588 更改对应版本的SDK即可.

随机推荐

  1. k8s pv无法删除问题

    一般删除步骤为:先删pod再删pvc最后删pv 但是遇到pv始终处于“Terminating”状态,而且delete不掉.如下图: 解决方法: 直接删除k8s中的记录: kubectl patch p ...

  2. dockerfile命令说明及使用

    执行Dockerfile命令: docker build -f /path/to/a/Dockerfil Dockerfile的基本结构 Dockerfile 一般分为四部分:基础镜像信息.维护者信息 ...

  3. WEB安全工程师整理资料

    安全产品  NESS   Nmap   AWVS Burp APPScan   chopper  sqlmap   kali linux    具体的教程可以在SEcWiki 上搜索  使用公开的漏洞 ...

  4. QT--初识

    一.组成QT的基本模块 二.创建一个简单工程 1.工程结构介绍 .pro 文件 QT += core gui # 包含的模块 greaterThan(QT_MAJOR_VERSION, ): QT + ...

  5. C++(三十七) — 字符串的函数重载—案例

    1.MyString.h 头文件 #pragma once #include <iostream> using namespace std; class MyString { public ...

  6. LFU(最近最不常用)实现(python)

    from collections import defaultdict, OrderedDict class Node: __slots__ = 'key', 'val', 'cnt' def __i ...

  7. CH5E26 扑克牌

    题意 5E26 扑克牌 0x5E「动态规划」练习 描述 一副不含王的扑克牌由52张牌组成,由红桃.黑桃.梅花.方块4组牌组成,每组13张不同的面值.现在给定52 张牌中的若干张,请计算将它们排成一列, ...

  8. windows部署tomcat

    一.下载相应的JDK以及tomcat的版本 JDK:jdk-8u131-windows-x64 tomcat:apache-tomcat-8.5.23-windows-x64.zip 二.JDK的安装 ...

  9. Python win32gui调用窗口到最前面

    Python win32gui调用窗口到最前面 0要写一个轮询几个重要页面的程序,不停的在大屏上进行刷新,通过pywin32模块下的SetForegroundWindow函数调用时,会出现error: ...

  10. 《了解python》

    编程语言的发展史: 1.机器语言 站在计算机角度,直接用二进制跟计算机直接沟通,直接操控硬件 优点:计算机能够直接读懂,运行速度快 缺点:开发效率低 2.汇编语言 站在计算机角度,用简单的英文标签标识 ...