title: SEVERE: Exception starting filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
body: <p>I am trying to make a small login application in struts 2. My web.xml:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  
      &lt;display-name&gt;StrutsPrj&lt;/display-name&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;filter-class&gt;
              org.apache.struts2.dispatcher.FilterDispatcher
          &lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;struts2&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;Login.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;/web-app&gt;
  </code></pre>
  
  <p>Struts.xml:</p>
  
  <p>
  </p>
  
  <pre><code>&lt;struts&gt;
      &lt;package name="default" extends="struts-default" namespace="/"&gt;
          &lt;action name="login" method="execute"
              class="struts2.LoginAction"&gt;
              &lt;result name="success"&gt;Welcome.jsp&lt;/result&gt;
              &lt;result name="error"&gt;Login.jsp&lt;/result&gt;
          &lt;/action&gt;
      &lt;/package&gt;
  &lt;/struts&gt;    
  </code></pre>
  
  <p>login.jsp:</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Login Screen - Struts 2&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;s:actionerror /&gt;
      &lt;s:form action="login.action" method="post"&gt;
          &lt;s:textfield name="username" value="UserName" size="20" /&gt;
          &lt;s:password name="password" value="Password" size="20" /&gt;
          &lt;s:submit method="execute" value="Login" align="center" /&gt;
      &lt;/s:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Welcome.jsp:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Welcome Screen - Struts 2&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2&gt;Congrates, &lt;s:property value="username" /&gt;...!&lt;/h2&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>LoginAction.java:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>package struts2;
  
  public class LoginAction {
      private String username;
      private String password;
  
      public String execute() {
          if (this.username.equals("admin")
              &amp;&amp; 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;
      }
  }
  </code></pre>
  
  <p>And i have added these libraries to my project:</p>
  
  <ul>
  <li>commons-logging-1.0.4.jar</li>
  <li>struts2-core-2.1.8.1.jar</li>
  <li>ognl-2.6.11.jar</li>
  <li>xwork-2.1.0.jar</li>
  <li>freemarker-2.3.9.jar</li>
  </ul>
  
  <p>When I try to run this on Tomcat 6 I got following error:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>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:\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Java/jre6/bin/client;C:/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Java\jdk1.5\bin\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Liquid Technologies\Liquid XML Studio 2009\XmlDataBinder7\Redist7\cpp\win32\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\MySQL\MySQL Server 5.0\bin
  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.&lt;init&gt;(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
  </code></pre>