<tfoot id='vHAQn'></tfoot>
    <bdo id='vHAQn'></bdo><ul id='vHAQn'></ul>

  • <small id='vHAQn'></small><noframes id='vHAQn'>

  • <i id='vHAQn'><tr id='vHAQn'><dt id='vHAQn'><q id='vHAQn'><span id='vHAQn'><b id='vHAQn'><form id='vHAQn'><ins id='vHAQn'></ins><ul id='vHAQn'></ul><sub id='vHAQn'></sub></form><legend id='vHAQn'></legend><bdo id='vHAQn'><pre id='vHAQn'><center id='vHAQn'></center></pre></bdo></b><th id='vHAQn'></th></span></q></dt></tr></i><div id='vHAQn'><tfoot id='vHAQn'></tfoot><dl id='vHAQn'><fieldset id='vHAQn'></fieldset></dl></div>

        <legend id='vHAQn'><style id='vHAQn'><dir id='vHAQn'><q id='vHAQn'></q></dir></style></legend>

        严重:异常启动过滤器 struts2 java.lang.ClassNotFoundException:org.apac

        SEVERE: Exception starting filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher(严重:异常启动过滤器 struts2 java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher) - IT屋-

            <legend id='hDH1K'><style id='hDH1K'><dir id='hDH1K'><q id='hDH1K'></q></dir></style></legend>

              <bdo id='hDH1K'></bdo><ul id='hDH1K'></ul>
                <tbody id='hDH1K'></tbody>
              <tfoot id='hDH1K'></tfoot>
              <i id='hDH1K'><tr id='hDH1K'><dt id='hDH1K'><q id='hDH1K'><span id='hDH1K'><b id='hDH1K'><form id='hDH1K'><ins id='hDH1K'></ins><ul id='hDH1K'></ul><sub id='hDH1K'></sub></form><legend id='hDH1K'></legend><bdo id='hDH1K'><pre id='hDH1K'><center id='hDH1K'></center></pre></bdo></b><th id='hDH1K'></th></span></q></dt></tr></i><div id='hDH1K'><tfoot id='hDH1K'></tfoot><dl id='hDH1K'><fieldset id='hDH1K'></fieldset></dl></div>

              1. <small id='hDH1K'></small><noframes id='hDH1K'>

                  本文介绍了严重:异常启动过滤器 struts2 java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在 struts 2 中制作一个小型登录应用程序.我的 web.xml:

                  I am trying to make a small login application in struts 2. My web.xml:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                      xmlns="http://java.sun.com/xml/ns/javaee" 
                      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
                      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
                  
                      <display-name>StrutsPrj</display-name>
                      <filter>
                          <filter-name>struts2</filter-name>
                          <filter-class>
                              org.apache.struts2.dispatcher.FilterDispatcher
                          </filter-class>
                      </filter>
                      <filter-mapping>
                          <filter-name>struts2</filter-name>
                          <url-pattern>/*</url-pattern>
                      </filter-mapping>
                      <welcome-file-list>
                          <welcome-file>Login.jsp</welcome-file>
                      </welcome-file-list>
                      </web-app>
                  

                  Struts.xml:

                  Struts.xml:

                  <struts>
                      <package name="default" extends="struts-default" namespace="/">
                          <action name="login" method="execute"
                              class="struts2.LoginAction">
                              <result name="success">Welcome.jsp</result>
                              <result name="error">Login.jsp</result>
                          </action>
                      </package>
                  </struts>    
                  

                  login.jsp:

                  <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
                  pageEncoding="ISO-8859-1"%>
                  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                  <%@ taglib prefix="s" uri="/struts-tags"%>
                  <html>
                  <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                  <title>Login Screen - Struts 2</title>
                  </head>
                  <body>
                  
                  <s:actionerror />
                      <s:form action="login.action" method="post">
                          <s:textfield name="username" value="UserName" size="20" />
                          <s:password name="password" value="Password" size="20" />
                          <s:submit method="execute" value="Login" align="center" />
                      </s:form>
                  </body>
                  </html>
                  

                  Welcome.jsp:

                  Welcome.jsp:

                  <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
                      pageEncoding="ISO-8859-1"%>
                  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                  <%@ taglib prefix="s" uri="/struts-tags"%>
                  <html>
                  <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                  <title>Welcome Screen - Struts 2</title>
                  </head>
                  <body>
                  <h2>Congrates, <s:property value="username" />...!</h2>
                  </body>
                  </html>
                  

                  LoginAction.java:

                  LoginAction.java:

                  package struts2;
                  
                  public class LoginAction {
                      private String username;
                      private String password;
                  
                      public String execute() {
                          if (this.username.equals("admin")
                              && this.password.equals("admin123")) {
                              return "success";
                          } else {
                          return "error";
                          }
                      }
                  
                      public String getUsername() {
                          return username;
                      }
                  
                      public void setUsername(String username) {
                          this.username = username;
                      }
                  
                      public String getPassword() {
                          return password;
                      }
                  
                      public void setPassword(String password) {
                          this.password = password;
                      }
                  }
                  

                  我已将这些库添加到我的项目中:

                  And i have added these libraries to my project:

                  • commons-logging-1.0.4.jar
                  • struts2-core-2.1.8.1.jar
                  • ognl-2.6.11.jar
                  • xwork-2.1.0.jar
                  • freemarker-2.3.9.jar

                  当我尝试在 Tomcat 6 上运行它时,出现以下错误:

                  When I try to run this on Tomcat 6 I got following error:

                  Mar 10, 2011 1:17:59 PM org.apache.catalina.core.AprLifecycleListener init
                  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:Javajre6in;.;C:WINDOWSSunJavain;C:WINDOWSsystem32;C:WINDOWS;C:/Java/jre6/bin/client;C:/Java/jre6/bin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:Javajdk1.5in;C:Program FilesTortoiseSVNin;C:Program FilesLiquid TechnologiesLiquid XML Studio 2009XmlDataBinder7Redist7cppwin32in;C:Program FilesQuickTimeQTSystem;C:Program FilesMySQLMySQL Server 5.0in
                  Mar 10, 2011 1:17:59 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
                  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:newPrj' did not find a matching property.
                  Mar 10, 2011 1:17:59 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
                  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context/Loader} Setting property 'useSystemClassLoaderAsParent' to 'false' did not find a matching property.
                  Mar 10, 2011 1:17:59 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
                  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StrutsPrj' did not find a matching property.
                  Mar 10, 2011 1:17:59 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
                  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context/Loader} Setting property 'useSystemClassLoaderAsParent' to 'false' did not find a matching property.
                  Mar 10, 2011 1:18:00 PM org.apache.coyote.http11.Http11Protocol init
                  INFO: Initializing Coyote HTTP/1.1 on http-8080
                  Mar 10, 2011 1:18:00 PM org.apache.catalina.startup.Catalina load
                  INFO: Initialization processed in 2037 ms
                  Mar 10, 2011 1:18:00 PM org.apache.catalina.core.StandardService start
                  INFO: Starting service Catalina
                  Mar 10, 2011 1:18:00 PM org.apache.catalina.core.StandardEngine start
                  INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
                  Mar 10, 2011 1:18:01 PM 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 1:18:01 PM org.apache.catalina.core.StandardContext start
                  SEVERE: Error filterStart
                  Mar 10, 2011 1:18:01 PM org.apache.catalina.core.StandardContext start
                  SEVERE: Context [/StrutsPrj] startup failed due to previous errors
                  Mar 10, 2011 1:18:01 PM org.apache.coyote.http11.Http11Protocol start
                  INFO: Starting Coyote HTTP/1.1 on http-8080
                  Mar 10, 2011 1:18:01 PM org.apache.jk.common.ChannelSocket init
                  INFO: JK: ajp13 listening on /0.0.0.0:8009
                  Mar 10, 2011 1:18:01 PM org.apache.jk.server.JkMain start
                  INFO: Jk running ID=0 time=0/97  config=null
                  Mar 10, 2011 1:18:01 PM org.apache.catalina.startup.Catalina start
                  INFO: Server startup in 1756 ms
                  

                  推荐答案

                  确保您的类路径上有以下内容:

                  Make sure the following are on your class path:

                  • commons-fileupload-X.X.X.jar
                  • commons-io-X.X.X.jar
                  • commons-logging-X.X.X.jar
                  • commons-logging-api.X.X.jar
                  • freemarker-X.X.X.jar
                  • ognl-X.X.X.jar
                  • struts2-core-X.X.X.X.jar
                  • xwork-core-X.X.X.jar
                  • javassist-3.7.ga.jar(Struts 2.2.1 及更高版本的新功能)
                  • commons-lang3-x.x

                  您是否关注过 https://struts.apache.org/getting-started/how-to-create-a-struts2-web-application.html 来设置你的项目?

                  Have you followed https://struts.apache.org/getting-started/how-to-create-a-struts2-web-application.html to set up your project?

                  试试:

                          <filter>
                              <filter-name>action</filter-name>
                              <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
                          </filter>
                          <filter-mapping>
                              <filter-name>action</filter-name>
                              <url-pattern>/*</url-pattern>
                          </filter-mapping>
                  

                  这篇关于严重:异常启动过滤器 struts2 java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                • <small id='1mCFF'></small><noframes id='1mCFF'>

                        <tbody id='1mCFF'></tbody>

                        <legend id='1mCFF'><style id='1mCFF'><dir id='1mCFF'><q id='1mCFF'></q></dir></style></legend>
                        <i id='1mCFF'><tr id='1mCFF'><dt id='1mCFF'><q id='1mCFF'><span id='1mCFF'><b id='1mCFF'><form id='1mCFF'><ins id='1mCFF'></ins><ul id='1mCFF'></ul><sub id='1mCFF'></sub></form><legend id='1mCFF'></legend><bdo id='1mCFF'><pre id='1mCFF'><center id='1mCFF'></center></pre></bdo></b><th id='1mCFF'></th></span></q></dt></tr></i><div id='1mCFF'><tfoot id='1mCFF'></tfoot><dl id='1mCFF'><fieldset id='1mCFF'></fieldset></dl></div>
                        1. <tfoot id='1mCFF'></tfoot>

                            <bdo id='1mCFF'></bdo><ul id='1mCFF'></ul>