Java.lang.NoClassDefFoundError:ActionSupport exception and action class not found exception(2012-09-02 11:28:38) reprint
Tags: struts actionsupport Tomcat |
Category: SSH |
There are usually two reasons why these exceptions occur:
1, may be not joined Xwork-2.1.2.jar this package caused by adding this package can be, if you join this package still does not solve the problem. Just look at the second reason below.
2. If you join this package, and in the process of configuring the Struts project, the following two situations occur:
(1) After you deploy the project for struts, and then start the Tomcat Web server, the following exception appears:
Serious: Exception starting filter Struts2
Java.lang.NoClassDefFoundError:ActionSupport
At Java.lang.ClassLoader.defineClass1 (Native method)
......
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:908)
At Java.lang.Thread.run (thread.java:619)
caused By:java.lang.ClassNotFoundException:ActionSupport
At Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1711)
At Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1556)
At Java.lang.ClassLoader.loadClassInternal (classloader.java:320)
... Panax Notoginseng
(2) The following exception occur when you start a Tomcat Web server and then redeploy the Struts project:
Serious: Exception starting filter Struts2
Unable to load configuration. -action-file:/d:/apache-tomcat-7.0.27/webapps/registration_5/web-inf/classes/struts.xml:9:68
At Com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration (configurationmanager.java:58)
At Org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration (dispatcher.java:360)
At Org.apache.struts2.dispatcher.Dispatcher.init (dispatcher.java:403)
At Org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher (initoperations.java:69)
At Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init ( STRUTSPREPAREANDEXECUTEFILTER.JAVA:48)
... org.apache.catalina.core.containerbase$containerbackgroundprocessor.run (containerbase.java:1526)
At Java.lang.Thread.run (thread.java:619)
caused By:action class [com.bjsxt.registeration.action] not found-action-file:/d:/apache-tomcat-7.0.27/webapps/ registration_5/web-inf/classes/struts.xml:9:68
... com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration (configurationmanager.java:55)
... More
From the above two anomalies, one is reported Actionsupport has not been loaded, one is to report an action class can not find, it is very clear that because the Strut.xml file configuration is not correct, the action does not configure its corresponding class path. That
<struts>
<constant name= "Struts.devmode" value= "true"/>
<package name= "registeration" extends= "Struts-default" >
<action name= "user" class= "com.bjsxt.registeration.action" >//this is not deep into the action package The Action class
<result name= "Success" >/registerSuccess.jsp</result>
<result name= "fail" >/registerFail.jsp</result>
</action>
</package>
</struts>
should be amended to:
<struts>
<constant name= "Struts.devmode" value= "true"/>
<package name= "registeration" extends= "Struts-default" >
<action name= "user" class= "com.bjsxt.registeration.action.UserAction" >//Plus action class
<result name= "Success" >/registerSuccess.jsp</result>
<result name= "fail" >/registerFail.jsp</result>
</action>
</package>
</struts>