Exception starting filter struts2 - tried adding JAR's, but same result
Since you are using Struts 2.3,
FilterDispatcher is deprecated. You MUST use StrutsPrepareAndExecuteFilter (or its little brothers).
From the official documentation
Deprecated. Since Struts 2.1.3, use StrutsPrepareAndExecuteFilter instead or StrutsPrepareFilter and StrutsExecuteFilter if needing using the ActionContextCleanUp filter in addition to this one
change then this
<!-- Struts < 2.1.3 -->
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
to this:
<!-- Struts >= 2.1.3 and < 2.5 -->
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
Note that, from 2.5, it would be instead:
<!-- Struts >= 2.5 -->
<filter-class>
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
</filter-class>
Exception starting filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
I figured out my problem was that I forgot to export my user defined libraries, in this case, struts libraries. You can export the libraries via Eclipse by
- Go to the Markers tab (If you can't see, do Windows > Show View > Markers)
- Expand "Classpath Dependency Validator Message"
- Right click "Classpath entry org.eclipse.jdt.USER_LIBRARY/struts2 will not be exported or published. Runtime ClassNotFoundExceptions may result."
- Click "Quick Fix"
- Select "Mark the associated raw classpath entry as a publish/export dependency."
- click "Finish"
Struts2 -- Exception starting filter struts
I replaced all the jar files I had with the ones from another application I have that's working and doesn't have this issue. This application works now. I'm guessing there was some clash between jar files that was causing the problem.
Exception starting filter struts2:NoSuchMethodError
struts.jar
struts2-convention-plugin-2.1.6.jar
struts2-core-2.3.14.3.jar
struts2-json-plugin-2.1.8.1.jar
struts2-tiles-plugin-2.1.6.jar
xwork2.jar
xwork-core-2.3.14.jar
This is beyond evilness. ALL the resources must be aligned (same version), and possibly updated to the latest version due to security issues. Also remove struts.jar
and xwork2.jar
(!!).
Then you need
struts.jar
struts2-convention-plugin-2.3.16.3.jar
struts2-core-2.3.16.3.jar
struts2-json-plugin-2.3.16.3.jar
struts2-tiles-plugin-2.3.16.3.jar
xwork2.jar
xwork-core-2.3.16.3.jar
Also update ognl.jar and freemarker.jar because they're old:
- latest ognl.jar;
- latest freemarker.jar.
Related Topics
Sharing Session Data Between Contexts in Tomcat
How to Fix "The Expression of Type List Needs Unchecked Conversion...'
Java: Join Array of Primitives with Separator
Why Do == Comparisons with Integer.Valueof(String) Give Different Results for 127 and 128
Which Is the Best Alternative for Java Serialization
Gradle to Execute Java Class (Without Modifying Build.Gradle)
Java: Convert String to Timestamp
Lambdaconversionexception with Generics: Jvm Bug
How Is Length Implemented in Java Arrays
Getting Database Connection in Pure JPA Setup
Java - Swing Listen an Action in a Text Field of a Form
How to Express Dependency in Maven on Java Ee Features for Transition to Java 9
Java Http Client Request with Defined Timeout
Why People Are So Afraid of Using Clone() (On Collection and Jdk Classes)