Struts2启动时,java.lang.ClassNotFoundException: org.apache.Struts2.dispatcher.FilterDispatcher

Struts2  版本2.3启动时,java.lang.ClassNotFoundException: org.apache.Struts2.dispatcher.FilterDispatcher


web.xml的配置文件如下:

         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">


    Struts Blank


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



   
        struts2
        *.action
   





所报错误的详细信息如下:

java.lang.ClassNotFoundException: org.apache.Struts2.dispatcher.FilterDispatcher
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1891)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

看了很多论坛,上面说的是新版的struts2中StrutsPrepareAndExecuteFilter代替了原来的FilterDispatcher。但报找不到类,手动添加类到文件中也不好使。

错误中的信息org.apache.Struts2.dispatcher.FilterDispatcher与导入struts2-core包中的类名确实不同,包中的类名org.apache.struts2.dispatcher.FilterDispatcher。

以上代码在Tomcat7中运行。

无意之中用Tomcat8运行了一下代码,不在报错了。我的问题也就解决了。

你可能感兴趣的:(java)