Tomcat startup Exception in Struts2: Exception starting filter struts2, a java. lang. ClassNotFoundException, struts2filter

Source: Internet
Author: User

Tomcat startup Exception in Struts2: Exception starting filter struts2, a java. lang. ClassNotFoundException, struts2filter

When writing a small example of struts2 + hibernate integration, start the Tomcat server and report:

Severe: Exception starting filter struts2
Java. lang. ClassNotFoundException: org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter

Tossing for a long time, finally know the reason, in the establishment of struts2 environment, the general approach is to drag the jar package to the lib file under the WEB-INF, Tomcat started, the jar file will be loaded in this directory, but if you are using User Libraries, there will be no corresponding jar file in lib, although the program compilation is no problem, however, it is very likely that this error will be reported during Tomcat startup,

The reason is simple:The referenced jar package was not automatically copied to the WEB-INF/directory when eclipse released the project, causing the compiler to fail to find the class in use.

Baidu found three solutions after half a day and tried them one by one. Only two solutions have been successfully solved.

  Method 1 (successful):

It's easy to discard User Librariy and put all jar files in the lib file directory. The problem is solved, but this is not what I want.

 Method 2 (failed):

When Tomcat is configured, the "debug" mode is selected by default, that is, the debug mode, which must be set to "run" or "run "..

The procedure is Windows> preferences> My eclispe> servers> Find Tomcat> Lauch.

 

Method 3 (successful):

Manually add the jar package in the User library to the directory automatically loaded when the project is released:

Right-click a project and choose Properties> Myeclispe> Deployment Assembly> new:

  

Select the User library you have created and click finish:

Redeploy the project and start Tomcat. The problem is solved !~~~~~

  

 

Related Article

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.