I am trying to make a small login application in struts 2. My web.xml:
I suggest doing a Maven build, the dependencies will be resolved by Maven. This is what I had to put in pom.xml
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
It seems, commons-lang3-XXX.jar file is missing in your class path. You can resolve it by adding the jar to your lib folder.
If you are using Struts2 version 2.5 you need to change from org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter to org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter. See:
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter in web.xml
Being new to the Struts2 framework, I recently came across the same (or very similar) error. In my case I was using annotations within the Action class rather than the struts.xml file.
For example
@Action(value="/jsp/edit-file",
results={@Result(name="success",location="/jsp/edit-success.jsp"),
@Result(name="failure",location="/jsp/edit-failure.jsp")})
public String execute() { ... }
However when I changed the action value to include the *.action extension (see below) Struts would throw the "SEVERE: Exception starting filter struts2" error noted above.
@Action(value="/jsp/edit-file.action",
results={@Result(name="success",location="/jsp/edit-success.jsp"),
@Result(name="failure",location="/jsp/edit-failure.jsp")})
public String execute() { ... }
The cause of this error wasn't obvious as it didn't manifest itself immediately. Looking through the Tomcat localhost..log file I found the stacktrace for the error and was able to remedy the issue.
Got similar problem while starting strut2 project.
I was using the latest jars. Web.xml has version 3.0. And it does not contains the proper dispatcher in its configuration. I added the correct dispatcher filter i.e.
org.apache.struts2.dispatcher.FilterDispatcher
instead of
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
or
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
it worked greatly.
Make sure the following are on your class path:
Edit: Have you followed http://struts.apache.org/release/2.3.x/docs/how-to-create-a-struts-2-web-application.html to set up your project? Why are you using struts 2.1.X.X and not 2.2.x.x?
Try:
<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>