Struts 映射在 Tomcat 8 上失败
Struts mapping failing on Tomcat 8
我在部署 war 时得到以下堆栈跟踪。但是,当我手动分解和部署它时,一切正常。
异常堆栈跟踪示例:
AuthorisationInterceptor.doAuthorisation: EXCEPTION TRAPPED e= No result defined for action com.myapp.oldapps.GenericOverview and result - No result defined for action com.myapp.oldapps.GenericSavingsOverview and result - action - file:/C:/tomcat/Tomcat%208.0/webapps/products/WEB-INF/classes/struts-oldapps.xml:31:133
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)........
org.apache.tiles.definition.NoSuchDefinitionException: GenericOverview
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:625)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:155)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:372)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
Struts 定义:
(struts-oldapps.xml)
<action name="GenericOverview" class="com.myapp.oldapps.GenericOverview" method="display">
<result name="success" type="tiles">GenericOverview</result>
<result name="kyc" type="tiles">GenericOverview</result>
<result name="input" type="tiles">GenericOverview</result>
<result name="error" type="tiles">BlockingError</result>
</action>
方块定义:
(tiles-defs-oldapps.xml)
<definition name="GenericOverview">
<put-attribute name="Body" value="/jsp/app/generic/GenericOverview.jsp" />
</definition>
我正在使用 Struts 版本 2.3.35 和磁贴 2.2.2
好问题!!!
我想您需要为此指定定义配置,如下所示:
在gradle(war任务)中添加以下部分
来自('src/main/application/META-INF'){
包括 '**/*.xml'
进入 'META-INF'
}
这会将保存在 META-INF 中的 application.xml 和其他 xml 文件复制到 WAR 中的父 META-INF 中。如果 META-INF 的位置不同,则该位置将在上面的任务中更改。
此外,对于基于 struts 的应用程序,请在 web.xml 和 运行 下方添加 war 工作
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>
/WEB-INF/classes/tiles-defs.xml,
........
</param-value>
</context-param>
希望对您有所帮助!!!
我在部署 war 时得到以下堆栈跟踪。但是,当我手动分解和部署它时,一切正常。
异常堆栈跟踪示例:
AuthorisationInterceptor.doAuthorisation: EXCEPTION TRAPPED e= No result defined for action com.myapp.oldapps.GenericOverview and result - No result defined for action com.myapp.oldapps.GenericSavingsOverview and result - action - file:/C:/tomcat/Tomcat%208.0/webapps/products/WEB-INF/classes/struts-oldapps.xml:31:133
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)........
org.apache.tiles.definition.NoSuchDefinitionException: GenericOverview
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:625)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:155)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:372)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245)
Struts 定义: (struts-oldapps.xml)
<action name="GenericOverview" class="com.myapp.oldapps.GenericOverview" method="display">
<result name="success" type="tiles">GenericOverview</result>
<result name="kyc" type="tiles">GenericOverview</result>
<result name="input" type="tiles">GenericOverview</result>
<result name="error" type="tiles">BlockingError</result>
</action>
方块定义: (tiles-defs-oldapps.xml)
<definition name="GenericOverview">
<put-attribute name="Body" value="/jsp/app/generic/GenericOverview.jsp" />
</definition>
我正在使用 Struts 版本 2.3.35 和磁贴 2.2.2
好问题!!! 我想您需要为此指定定义配置,如下所示:
在gradle(war任务)中添加以下部分
来自('src/main/application/META-INF'){ 包括 '**/*.xml' 进入 'META-INF' } 这会将保存在 META-INF 中的 application.xml 和其他 xml 文件复制到 WAR 中的父 META-INF 中。如果 META-INF 的位置不同,则该位置将在上面的任务中更改。
此外,对于基于 struts 的应用程序,请在 web.xml 和 运行 下方添加 war 工作
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>
/WEB-INF/classes/tiles-defs.xml,
........
</param-value>
</context-param>
希望对您有所帮助!!!