问题描述
<?xmlversion="1.0"encoding="UTF-8"?><web-appxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID"version="2.5"><display-name>TestMyself</display-name><welcome-file-list><welcome-file>/login.jsp</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:applicationContext.xml</param-value></context-param><!--<servlet><servlet-name>login</servlet-name><servlet-class>action.LoginAction</servlet-class></servlet><servlet-mapping><servlet-name>login</servlet-name><url-pattern>/login</url-pattern></servlet-mapping>!--><filter><filter-name>struts</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><!--配置所有的URL都需经过Struts2过滤器处理--><filter-mapping><filter-name>struts</filter-name><url-pattern>/*</url-pattern></filter-mapping><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener></web-app><?xmlversion="1.0"encoding="UTF-8"?><web-appxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID"version="2.5"><display-name>TestMyself</display-name><welcome-file-list><welcome-file>/login.jsp</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:applicationContext.xml</param-value></context-param><!--<servlet><servlet-name>login</servlet-name><servlet-class>action.LoginAction</servlet-class></servlet><servlet-mapping><servlet-name>login</servlet-name><url-pattern>/login</url-pattern></servlet-mapping>!--><filter><filter-name>struts</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><!--配置所有的URL都需经过Struts2过滤器处理--><filter-mapping><filter-name>struts</filter-name><url-pattern>/*</url-pattern></filter-mapping><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener></web-app><?xmlversion="1.0"encoding="UTF-8"?><!---Middletierapplicationcontextdefinitionfortheimagedatabase.--><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd"><beanid="la"class="action.LoginActionTest"><propertyname="Stuservice"><refbean="Stuservice"/></property></bean><!--<beanname="LoginActionTest"class="action.LoginActionTest"><propertyname="Logindao"><refbean="Logindao"/></property></bean>--><beanname="Logindao"class="dao.LoginDao"></bean></beans>UnabletoinstantiateAction,la,definedfor'login'innamespace'/'lacom.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:307)com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rootcausejava.lang.ClassNotFoundException:laorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:146)com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:96)com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:212)com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:132)com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288)com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)struts.xml<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.1.7//EN""http://struts.apache.org/dtds/struts-2.1.7.dtd"><struts><includefile="struts-default.xml"></include><constantname="struts.objectFactory"value="spring"></constant><packagename="login"extends="struts-default"><actionname="login"class="la"method="login"><resultname="su">success.jsp</result><resultname="failure">failure.jsp</result></action></package></struts>namespace应该不需要加啊我的form里也没加啊。
解决方案
解决方案二:
都加有试试吗?是你少加了“”可能框架就规定的吧加上试试!
解决方案三:
你的strute2的jar包是哪一个?完整吗?
解决方案四:
引用1楼wengqd_54的回复:
都加有试试吗?是你少加了“”可能框架就规定的吧加上试试!
jar包完整namespace="/"一样结果namespace=""StatusreportmessageThereisnoActionmappedfornamespace/andactionnamelogin.descriptionTherequestedresource(ThereisnoActionmappedfornamespace/andactionnamelogin.)isnotavailable.应该不是namespace的关系吧我很郁闷的
解决方案五:
Action未被实例化,建议LZ检查下applicationContext.xml文件中Action路径是否正确。