新手第一个Struts程序报错提示过滤器ClassNotFoundException? 财富值40

2016-10-15 11:43发布

部署环境是tomcat8 + struts2.3 + IDEA2016

这是启动时的报错信息

Connected to server [2016-10-15 11:11:00,477] Artifact Struts-Jee:war exploded: Artifact is being deployed, please wait... 15-Oct-2016 11:11:02.818 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 15-Oct-2016 11:11:02.907 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file 15-Oct-2016 11:11:02.908 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors [2016-10-15 11:11:02,947] Artifact Struts-Jee:war exploded: Error during artifact deployment. See server log for details. 15-Oct-2016 11:11:10.062 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/apache-tomcat-8.0.38/webapps/manager 15-Oct-2016 11:11:10.246 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/apache-tomcat-8.0.38/webapps/manager has finished in 161 ms

这是Tomcat Localhost Log的报错信息,我的包都已经正确引入了啊,为什么会ClassNotFoundException呢?

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

15-Oct-2016 11:11:02.905 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter struts2  java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter     at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)     at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)     at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:518)     at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:499)     at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)     at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)     at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)     at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4700)     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5340)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)     at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)     at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484)     at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)     at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)     at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)     at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)     at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)     at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)     at sun.rmi.transport.Transport$1.run(Transport.java:200)     at sun.rmi.transport.Transport$1.run(Transport.java:197)     at java.security.AccessController.doPrivileged(Native Method)     at sun.rmi.transport.Transport.serviceCall(Transport.java:196)     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)     at java.security.AccessController.doPrivileged(Native Method)     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at java.lang.Thread.run(Thread.java:745)

这是Tomcat Catalina Log的报错信息

15-Oct-2016 11:11:02.908 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors

这是com.zxy.UserAction.java内容

package com.zxy;  import com.opensymphony.xwork2.ActionSupport;  /**  * Created by alps on 10/15/16.  */ public class UserAction extends ActionSupport {     public String add() throws Exception {         return "add";     }      public String update() throws Exception {         return "update";     } }

这是struts.xml文件内容

<?xml version="1.0" encoding="UTF-8"?>  <!DOCTYPE struts PUBLIC         "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"         "http://struts.apache.org/dtds/struts-2.3.dtd">  <struts>     <package name="myPackage" extends="struts-default">         <action name="userAction" class="com.zxy.UserAction">             <result name="add">index.jsp</result>             <result name="update">index.jsp</result>         </action>     </package> </struts> 


web.xml内容,IDEA自动帮我新建的,没有修改过

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"          version="3.1">     <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> </web-app> 

第一个Struts程序,报错信息看得不是很懂,希望大神指教!

友情提示: 问题已经关闭,关闭后问题禁止继续编辑,回答。