0

I have built an application using Struts 2, I tried everything but still getting this issue:

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    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.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    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(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

I have added these jar files :
asm-3.3
asm-commons-3.3
asm-tree-3.3
commons-io-2.4
commons-lang-2.4
commons-lang3-3.4
commons-logging-1.1.3
commons-logging-api-1.1
freemarker-2.3.23
javassist-3.20.0-GA
ognl-3.1.10
struts2-core-2.5.2
xwork-core-2.1.6

By using deployment assembly I have added the libraries to eclipse by using java build path entries but I am not getting these jars in WEB-INF/lib folder.

<?xml version="1.0" encoding="UTF-8"?>
<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">
  <display-name>Struts2Project</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

<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>

</web-app>

What should I do to run the server?

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • http://stackoverflow.com/questions/23421278/exception-starting-filter-struts2-java-lang-classnotfoundexception-org-apache-s – Pradeep Oct 07 '16 at 14:25
  • Can you check with this link .Also make sure that in your java build path all the libraries are present.That you can check with windows->preference s tab and java build path – Pradeep Oct 07 '16 at 14:27
  • Pradeep - I tried doing this but its not working fine – Malhotra08 Oct 07 '16 at 14:27
  • 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 – Pradeep Oct 07 '16 at 14:32
  • http://struts.apache.org/docs/version-notes-25.html – Pradeep Oct 07 '16 at 14:32
  • Hey Its working .. thanks :) – Malhotra08 Oct 07 '16 at 15:29

0 Answers0