"Go" Eclipse configuration Struts2 problem: classnotfoundexception:org ... Dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

Source: Internet
Author: User

My solution

At first, I was in accordance with a textbook, configured with user Libraries (named struts-2.2.3, multiple projects can be used more than once), and then directly introduced struts-2.2.3 (this package will not be really placed in the project folder):

However, the error is shown in the title of the operation, the program cannot start, the specific error is as follows:

Severity: Exception Starting filter Struts2
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:4071)
At Org.apache.catalina.core.StandardContext.start (standardcontext.java:4725)
At Org.apache.catalina.core.ContainerBase.start (containerbase.java:1053)
At Org.apache.catalina.core.StandardHost.start (standardhost.java:840)
At Org.apache.catalina.core.ContainerBase.start (containerbase.java:1053)
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:39)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25)
At Java.lang.reflect.Method.invoke (method.java:597)
At Org.apache.catalina.startup.Bootstrap.start (bootstrap.java:289)
At Org.apache.catalina.startup.Bootstrap.main (bootstrap.java:414)

Baidu in Google, there is no effective solution. According to the error, it means that the class org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter is not found, but I did find the class manually:

To make sure that the name of the class is not misspelled, right-click the Strutsprepareandexecutefilter.class file, select "Copy qualified name" (copy the exact name), Paste to the appropriate location in the Web. xml file, save the rerun, and the same error appears, proving that the name of the class is not spelled correctly.

Finally I discarded the user Libraries and manually copied the STRUTS2 related jar to the/webcontent/web-inf/lib directory:

Re-run the program, success!

That is, Tomcat loads resources from the web-inf/directory by default, and Eclipse does not copy the user libraries's associated resources into the web-inf/directory when it publishes the program (Eclipse will put all non-* in the SRC directory. Java files are copied to the Web-inf/classes directory), so Tomcat says it cannot find the required classes.

Other Solutions

In the comments in this article:

1. Whbaicxy gave other solutions: the release of the user library under Eclipse. Please try and look forward to all the results of the settlement in the comments below this article.

2. Orangekent Students ' solutions:

I have also encountered this situation, but the solution is very simple.
Why is tomcat not copying the jar package to the operating environment? Because we chose "debug mode", "Debug" in the configuration of Tomcat, it needs to be set to "production mode", "Run" and then redeployed.
Mode setting Location: Myeclipse--preferences--servers--tomcatxx--launch Select "Run Mode".

Note:

Tool Version:

tomcat:6.0.32

Eclipse Java ee:3.6.2

struts2:2.2.3

Tools: QQ

Photo Editor: MSPaint

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

from:http://blog.csdn.net/njnu_mjn/article/details/6684661

"Go" Eclipse configuration Struts2 problem: classnotfoundexception:org ... Dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

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.