This is a common error message for a new Struts2 developer. Many Struts 2 related websites have been reported this problem. Overall, when we see a ClassNotFoundException, we should have a reflection that it is very possible that the build path is wrong somewhere. java
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher web
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher 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.(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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
The problem is caused by the class path. apache
After you create a dynamic web project under eclipse, you should have the following directory underProject Explorer view. app
You may Add External Jars under Java Build Path window like the following: eclipse
This works for regular Java project, but does not work for Struts2 web project. ui
The solution is to simply copy the jar files required to the "lib" directory, then the error message will be gone.
(remove all jars from the class path if you added them before) this
Note: Actually, when the error message is something about ClassNotFoundException, we should think in the direction of build path is not correct. Also, different kinds of Java project may use different way to configure build path, e.g., an eclipse plug-in project have to use plug-in to add some library to it. spa