Search code examples
javamavenstruts2struts

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter at building normal struts login application


Facing this issue while building a simple Struts application

All the jar files are correctly imported as my another struts application is working perfectly

Web.xml

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp"
    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>WB AOS Data Admin App</display-name>

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

Solution

  • Sometimes additional imported dependencies can cause this type of error. Try reducing to the minimum required dependencies for a Struts 2 application.

    See the linked question/answer for more help regarding this error.

    Additional information:

    How To Create A Struts 2 Web Application