FWJKH
2015-05-19 01:47
采纳率: 50%
浏览 5.4k
已采纳

Struts2配置报错:java.lang.ClassNotFoundException

严重: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter
.StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1383)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
at java.lang.Thread.run(Thread.java:619)
2015-5-19 9:42:40 org.apache.catalina.core.StandardContext start
严重: Error filterStart

<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

<!-- 定义Struts2的核心filter --><!-- org.apache.struts2.dispatcher.FilterDispatcher -->

struts2
org.apache.struts2.dispatcher.ng.filter
.StrutsPrepareAndExecuteFilter

<!-- 让struts2的核心Filter拦截所有请求 -->

struts2
/*


login.jsp

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

7条回答 默认 最新

  • 冰冻火山 2015-05-19 01:59
    已采纳

    please user
    org.apache.struts2.dispatcher.FilterDispatcher
    instead of the
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

    The FilterDispatcher is deprecated since struts-version 2.1.3

    点赞 打赏 评论
  • 等待时候 2015-05-19 01:56

    Struts2少了对应的jar包,你看下是不是没有导入进来!

    点赞 打赏 评论
  • 冰冻火山 2015-05-19 02:01

    it may be, that you are using an old version of struts2. Before struts-version 2.1.3 we were using the
    org.apache.struts2.dispatcher.FilterDispatcher
    instead of the
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    The FilterDispatcher is deprecated since struts-version 2.1.3.

    点赞 打赏 评论
  • FWJKH 2015-05-19 02:03

    里面有这个包啊,而且还找到那个class

    点赞 打赏 评论
  • Gavin1994 2015-05-19 02:55

    从报错信息来看,是struts2的jar包缺少的问题,楼主是在web.xml中配置的struts2的filter-class,可能是struts2的版本问题(org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter这个类在struts2-2.1.x开始出现的,用来代替org.apache.struts2.dispatcher.FilterDispatcher)或者jar包未加载的问题(jar包要在lib文件夹下)。若不明白,可私信我!

    点赞 打赏 评论
  • 冰冻火山 2015-05-19 02:57

    把最新的commons/lang包加入就ok了,如果用maven就更方法了

    点赞 打赏 评论
  • 冰冻火山 2015-05-19 02:58

    Commons Lang 3.4

    点赞 打赏 评论

相关推荐 更多相似问题