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 !~~~~~