MOHIT PATTNI
MOHIT PATTNI

Reputation: 23

Struts mapping failing on Tomcat 8

I get the following stacktrace when I deploy a war. However, when I manually explode and deploy it, everything works fine.

Exception stacktrace sample:

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 definition: (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 definition: (tiles-defs-oldapps.xml)

<definition name="GenericOverview">        
        <put-attribute name="Body" value="/jsp/app/generic/GenericOverview.jsp" />
    </definition>

I'm using Struts version 2.3.35 and tiles 2.2.2

Upvotes: 2

Views: 133

Answers (1)

Dipen Shah
Dipen Shah

Reputation: 42

Good question!!! I guess you need to specify the definition config for this as below :

Add below part in gradle (war task)

from ( 'src/main/application/META-INF' ) { include '**/*.xml' into 'META-INF' } This will copy application.xml and other xml file kept in META-INF into parent META-INF in WAR. If location of META-INF is different then the location will change in the task above.

Additionally for struts based application add below in web.xml and run the war job

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

Hope this helps!!!

Upvotes: 1

Related Questions