Struts Problem Report
Struts has detected an unhandled exception:
Messages:
testAction
Unable to instantiate Action, testAction, defined for 'test' in namespace '/'testAction
File: org/apache/catalina/loader/WebappClassLoader.java
Line number: 1,714
Stacktraces
Unable to instantiate Action, testAction, defined for 'test' in namespace '/'testAction
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext_*.xml classpath*/context/applicationContext_*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>180</session-timeout>
</session-config>
</web-app>
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<global-results>
<result name="error">/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
<action name="index">
<result>/index.jsp</result>
</action>
<action name="test" class="testAction" method="execute">
<result name="success">/test.jsp</result>
</action> -->
</package>
<!-- <include file="config/struts/*" /> -->
</struts>
实在不行,自己下载个struts的源代码,调试一下,断点设置在DefaultActionInvocation的setObjectFactory()里,这样就能看到为什么没有应用到Spring的ObjectFactory了。