java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher

时间:2011-03-10 05:31:55

标签: struts2

我是Struts的新手,我遇到了这样的问题

INFO: Starting service Catalina
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
    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.<init>(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.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/StrutsPrj] startup failed due to previous errors
Mar 10, 2011 10:40:39 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 10, 2011 10:40:39 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 10, 2011 10:40:39 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16  config=null
Mar 10, 2011 10:40:39 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 625 ms

我的struts.xml文件中还有一些probs

<?xml version="1.0" encoding="UTF-8" ?>**
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"  "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.custom.i18n.resources" value="AppResources" />
    <package name="default" extends="struts-default" namespace="/">
        <action name="login"
            class="sturts2.LoginAction">
            <result name="success">Welcome.jsp</result>
            <result name="error">Login.jsp</result>
        </action>
    </package>
</struts> 

在struts.xml的第一行,我得到了这样的错误:

  

引用文件包含错误(http://struts.apache.org/dtds/struts-2.0.dtd)。有关详细信息,请右键单击“问题视图”中的消息,然后选择“显示详细信息...”

1 个答案:

答案 0 :(得分:0)

这对我有用:

  1. 将所有必要的jar文件复制到WebContent&gt; WEB-INF&gt; lib文件夹
  2. 确保您添加了 commons-lang3-3.1 struts2-core-2.3.16.3