Java.lang.ClassNotFoundException:org.apache.strut

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.