java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:209)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2012-3-5 14:44:49 org.apache.catalina.core.StandardContext start
严重: Error filterStart[web.xml ]
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
包都加上了。五个包
commons-logging-1.0.4.jar
freeer-2.3.8.jar
ognl-2.6.11.jar
struts2-core-2.0.14.jar
xwork-2.0.7.jar
怎么弄都还是报错。

解决方案 »

  1.   

    struts2-core-2.1.8.jar
    xwork-2.1.2.jar用的是这两个包,上面错了。但是还是会报错。2012-3-5 15:04:40 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\java\jdk1.5.0_09\jdk1.5.0_09\bin;D:\Tools\apache-tomcat-5.5.20\bin
    2012-3-5 15:04:40 org.apache.coyote.http11.Http11BaseProtocol init
    信息: Initializing Coyote HTTP/1.1 on http-3344
    2012-3-5 15:04:40 org.apache.catalina.startup.Catalina load
    信息: Initialization processed in 578 ms
    2012-3-5 15:04:40 org.apache.catalina.core.StandardService start
    信息: Starting service Catalina
    2012-3-5 15:04:40 org.apache.catalina.core.StandardEngine start
    信息: Starting Servlet Engine: Apache Tomcat/5.5.20
    2012-3-5 15:04:40 org.apache.catalina.core.StandardHost start
    信息: XML validation disabled
    2012-3-5 15:04:40 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    信息: Parsing configuration file [struts-default.xml]
    2012-3-5 15:04:40 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
    严重: Dispatcher initialization failed
    Unable to load configuration. - bean - jar:file:/F:/workspace/ahyd/Test/WebContent/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:47:178
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
    Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/F:/workspace/ahyd/Test/WebContent/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:47:178
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 22 more
    Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/RequestContext
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getDeclaredConstructors(Class.java:1808)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:212)
    ... 25 more
    2012-3-5 15:04:40 org.apache.catalina.core.StandardContext filterStart
    严重: Exception starting filter struts2
    Unable to load configuration. - bean - jar:file:/F:/workspace/ahyd/Test/WebContent/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:47:178
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
    Caused by: Unable to load configuration. - bean - jar:file:/F:/workspace/ahyd/Test/WebContent/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:47:178
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    ... 20 more
    Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/F:/workspace/ahyd/Test/WebContent/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:47:178
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 22 more
    Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/RequestContext
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getDeclaredConstructors(Class.java:1808)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:212)
    ... 25 more
    2012-3-5 15:04:40 org.apache.catalina.core.StandardContext start
    严重: Error filterStart
    2012-3-5 15:04:40 org.apache.catalina.core.StandardContext start
    严重: Context [/test] startup failed due to previous errors
    2012-3-5 15:04:41 org.apache.coyote.http11.Http11BaseProtocol start
    信息: Starting Coyote HTTP/1.1 on http-3344
    2012-3-5 15:04:41 org.apache.jk.common.ChannelSocket init
    信息: JK: ajp13 listening on /0.0.0.0:8009
    2012-3-5 15:04:41 org.apache.jk.server.JkMain start
    信息: Jk running ID=0 time=0/31  config=null
    2012-3-5 15:04:41 org.apache.catalina.storeconfig.StoreLoader load
    信息: Find registry server-registry.xml at classpath resource
    2012-3-5 15:04:41 org.apache.catalina.startup.Catalina start
    信息: Server startup in 1203 ms
      

  2.   

    你用的struts2.0应该是 <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>不是你写的,你那种是2.1以上的配置
      

  3.   

    如果程序报类找不到异常,且后面有org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter  等信息,可能是你的版本问题.解决方法是确定你的struts版本, 如果是2.1.3之前的版本,用org.apache.struts2.dispatcher.FilterDispatcher,以后的版本则配置org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter ----网上是这么说的。
    我发现你这些错误在百度里都能找到相应的解决办法的。
      

  4.   

    知道什么原因了,,原来我在网上下的包commons-fileupload-1.2.1.jar有问题。加上这个包就行了也谢谢各位了。。