Tomcat 8上的Struts映射失败

问题描述 投票:2回答:1

我在展开战争时得到以下堆栈跟踪信息。但是,当我手动爆炸并部署它时,一切正常。

异常堆栈跟踪样本:

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

java struts2 tomcat8 tiles apache-tiles
1个回答
0
投票

好问题!!!我想您需要为此指定定义配置,如下所示:

在gradle中添加下面的部分(战争任务)

来自('src / main / application / META-INF'){包括'** / *。xml'进入“ META-INF”}这会将META-INF中保存的application.xml和其他xml文件复制到WAR中的父META-INF中。如果META-INF的位置不同,则在上面的任务中该位置将更改。

另外,对于基于struts的应用程序,请在下面的web.xml中添加并运行战争任务

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

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.