title: NoSuchDefinitionException when using struts2 with tiles plugin. All previous questions checked
body: <p>Im trying to use tiles with struts 2 and get a NoSuchDefinitionException. None of the solutions on stackoverflow or google fixed my issue so i decided to post a new question.
  below is the configuration for struts  and tiles. Im using sample test pages which are not complete.</p>
  
  <p>a) Web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns: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/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;ezviewocean&lt;/display-name&gt;
    &lt;description&gt;EZ-View Ocean&lt;/description&gt;
          &lt;context-param&gt;
              &lt;param-name&gt; org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/tiles.xml&lt;/param-value&gt;
          &lt;/context-param&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.apache.struts2.tiles.StrutsTilesListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;struts-prepare&lt;/filter-name&gt;
          &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;struts-prepare&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;login.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>b)struts.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  
  &lt;!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
      "http://struts.apache.org/dtds/struts-2.3.dtd"&gt;
  
  &lt;struts&gt;
      &lt;constant name="struts.enable.DynamicMethodInvocation" value="false" /&gt;
      &lt;constant name="struts.devMode" value="true"/&gt;
      &lt;constant name="struts.custom.i18n.resources" value="ApplicationResources"/&gt;
  
      &lt;package name="default" extends="struts-default" namespace="/"&gt;
          &lt;result-types&gt;
           &lt;result-type name="tiles" 
           class="org.apache.struts2.views.tiles.TilesResult" /&gt;
          &lt;/result-types&gt;
          &lt;action name="login" method="execute"
              class="com.schenker.ocean.actions.LoginAction"&gt;
              &lt;result name="success" type="tiles"&gt;/baseLayout&lt;/result&gt;
              &lt;result name="input"&gt;/login.jsp&lt;/result&gt;
              &lt;result name="fail"&gt;/login.jsp&lt;/result&gt;
          &lt;/action&gt;
      &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>b.5) tiles.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  
  &lt;!DOCTYPE tiles-definitions PUBLIC
     "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
     "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"&gt;
  
  &lt;tiles-definitions&gt;
  
     &lt;definition name="baseLayout" template="/baseLayout.jsp"&gt;
        &lt;put-attribute name="title"  value="Template"/&gt;
        &lt;put-attribute name="header" value="/header.jsp"/&gt;
        &lt;put-attribute name="leftmenu"   value="/leftmenu.jsp"/&gt;
        &lt;put-attribute name="body"   value="/body.jsp"/&gt;
        &lt;put-attribute name="footer"   value="/footer.jsp"/&gt;
     &lt;/definition&gt;
  
     &lt;definition name="view" extends="baseLayout"&gt;
        &lt;put-attribute name="title"  value="View"/&gt;
        &lt;put-attribute name="body"   value="/viewBody.jsp"/&gt;      
     &lt;/definition&gt;
  
     &lt;definition name="assign" extends="baseLayout"&gt;
        &lt;put-attribute name="title"  value="Assign"/&gt;
        &lt;put-attribute name="body"   value="/assignBody.jsp"/&gt;      
     &lt;/definition&gt;
  
  &lt;/tiles-definitions&gt;
  </code></pre>
  
  <p>c)baseLayout.jsp</p>
  
  <pre><code>&lt;%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;&lt;tiles:insertAttribute name="title" ignore="true" /&gt;
  &lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
     &lt;tiles:insertAttribute name="header" /&gt;&lt;br/&gt;
     &lt;hr/&gt;
     &lt;tiles:insertAttribute name="leftMenu" /&gt;&lt;br/&gt;
     &lt;hr/&gt;
     &lt;tiles:insertAttribute name="body" /&gt;&lt;br/&gt;
     &lt;hr/&gt;
     &lt;tiles:insertAttribute name="footer" /&gt;&lt;br/&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>below is the stack trace.</p>
  
  <pre><code>Stacktraces
  
  org.apache.tiles.definition.NoSuchDefinitionException: /baseLayout.tiles
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:625)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
      org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
      org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
      com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
      org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
      org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
  </code></pre>
  
  <p>I tried to debug the application and checked what value was being sent to TilesResult.class and figured its exactly the same as defined in struts.xml.. sooooo why didnt it pick up that configuration from tiles.xml?</p>