Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter when starting Simple Struts2 Application
    primarykey
    data
    text
    <p>I am trying to run a simple Struts2 application but it always throw the following exception:</p> <pre><code>java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </code></pre> <p>I have followed the step by step tutorial in <a href="http://struts.apache.org/development/2.x/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html" rel="nofollow">http://struts.apache.org/development/2.x/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html</a> but I cannot make it work. I also managed to find other Struts2 tutorial which uses maven but all failed. It throws the same exception when I try to run the application.</p> <p>I used the following:</p> <ul> <li>Eclipse </li> <li>Maven</li> <li>Tomcat</li> <li>Struts2</li> </ul> <p>According to other discussions, the dependencies jar files(e.g. struts2-core) must be put on the lib folder but as for me, I am using Maven so all the dependencies are already included in my build path under Maven Dependencies.</p> <p>I even tried running the sample project given in Struts2 website (<a href="https://code.google.com/p/struts2-examples/downloads/detail?name=Basic_Struts_2_Maven_2_3_1_2.zip&amp;can=2&amp;q=" rel="nofollow">Basic_Struts_2_Maven_2_3_1_2.zip</a>) but I still have no luck. Building it is successful but running it on server always fail. </p> <p>Am I missing anything?</p> <p><strong>Here's the <code>web.xml</code>:</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; &lt;display-name&gt;Basic_Struts2_Maven&lt;/display-name&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;filter&gt; &lt;filter-name&gt;struts2&lt;/filter-name&gt; &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&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;/web-app&gt; </code></pre> <p><strong><code>pom.xml</code>:</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;manning&lt;/groupId&gt; &lt;artifactId&gt;Basic_Struts2_Mvn&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;name&gt;Basic Struts 2&lt;/name&gt; &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;/properties&gt; &lt;build&gt; &lt;finalName&gt;Basic_Struts2_Mvn&lt;/finalName&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.struts&lt;/groupId&gt; &lt;artifactId&gt;struts2-core&lt;/artifactId&gt; &lt;version&gt;2.3.1.2&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;log4j&lt;/groupId&gt; &lt;artifactId&gt;log4j&lt;/artifactId&gt; &lt;version&gt;1.2.14&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <p><strong><code>struts.xml</code>:</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"&gt; &lt;struts&gt; &lt;constant name="struts.devMode" value="true" /&gt; &lt;package name="basicstruts2" extends="struts-default"&gt; &lt;action name="index"&gt; &lt;result&gt;/index.jsp&lt;/result&gt; &lt;/action&gt; &lt;/package&gt; &lt;/struts&gt; </code></pre> <p><strong><code>.classpath</code>:</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;classpath&gt; &lt;classpathentry kind="src" output="target/classes" path="src/main/java"/&gt; &lt;classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/&gt; &lt;classpathentry kind="src" output="target/test-classes" path="src/test/java"/&gt; &lt;classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/&gt; &lt;classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/&gt; &lt;classpathentry kind="output" path="target/classes"/&gt; &lt;/classpath&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload