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个回答

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

FWJKH
FWJKH I change, but occurr the other error:java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
5 年多之前 回复

Commons Lang 3.4

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

FWJKH
FWJKH 里面有这个包啊,而且还找到那个class
5 年多之前 回复

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
FWJKH struts-version 2.3.15.1
5 年多之前 回复

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

从报错信息来看,是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文件夹下)。若不明白,可私信我!

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐