This was a common error message for a new STRUTS2 developer. Many Struts 2 related websites has been reported this problem. Overall, when we see a classnotfoundexception, we should has a reflection that it's very possible that's the build path is Wrong somewhere.
Java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher
Java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcherat 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.
After you create a dynamic Web project under Eclipse, you should the following directory underproject explorer View.
You could Add External Jars under Java Build Path window like the following:
This is a works for regular Java project, and does not work for STRUTS2 Web project.
The solution is to simply copy the jar files required to the "Lib" directory and then the error message would be gone.
(Remove all jars from the class path if you added them before)
Note:actually, when the error message was something about classnotfoundexception, we should think in the direction of Buil D path is not correct. Also, different kinds of Java project may use different-path to configure build paths, e.g., an Eclipse plug-in project has To the plug-in to add some library to it.
Java.lang.ClassNotFoundException:org.apache.strut