title: Spring 4.1.5 and Tiles 3.0.5
body: <p>I want to integrate Spring MVC with Apache Tiles, given the version, when I run my webapp it shows a strange error. Please see logs.</p>
  
  <pre><code>Apr 13, 2015 8:35:05 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [tiles] in context with path [/TestMvcTiles] threw exception [Request processing failed; nested exception is org.apache.tiles.definition.DefinitionsFactoryException: XML error reading definitions.] with root cause
  org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 19; Document root element "tiles-definition", must match DOCTYPE root "tiles-definitions".
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.apache.commons.digester.Digester.parse(Digester.java:1887)
      at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:325)
      at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.loadDefinitionsFromResource(BaseLocaleUrlDefinitionDAO.java:150)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:234)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:225)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:225)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:203)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitions(CachingLocaleUrlDefinitionDAO.java:192)
      at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitions(ResolvingLocaleUrlDefinitionDAO.java:68)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.checkAndloadDefinitions(CachingLocaleUrlDefinitionDAO.java:174)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:131)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105)
      at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49)
      at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89)
      at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286)
      at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273)
      at org.apache.tiles.renderer.DefinitionRenderer.isRenderable(DefinitionRenderer.java:64)
      at org.springframework.web.servlet.view.tiles3.TilesView.checkResource(TilesView.java:116)
      at org.springframework.web.servlet.view.UrlBasedViewResolver.loadView(UrlBasedViewResolver.java:483)
      at org.springframework.web.servlet.view.AbstractCachingViewResolver.createView(AbstractCachingViewResolver.java:244)
      at org.springframework.web.servlet.view.UrlBasedViewResolver.createView(UrlBasedViewResolver.java:446)
      at org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:156)
      at org.springframework.web.servlet.DispatcherServlet.resolveViewName(DispatcherServlet.java:1267)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p><strong>/WEB-INF/web.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE xml&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/ns/javaee/web-app_4_1.xsd"
  xmlns:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/ns/javaee/web-app_4_1.xsd"
  id="WebApp_ID" version="4.1"&gt;
  
  &lt;display-name&gt;tiles&lt;/display-name&gt;
         &lt;servlet&gt;
                &lt;servlet-name&gt;tiles&lt;/servlet-name&gt;
                &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
                &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;    
         &lt;/servlet&gt;   
  
         &lt;servlet-mapping&gt;
                &lt;servlet-name&gt;tiles&lt;/servlet-name&gt;
                &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
         &lt;/servlet-mapping&gt;
  
         &lt;listener&gt;
                &lt;listener- class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
         &lt;/listener&gt;
         &lt;welcome-file-list&gt;
                &lt;welcome-file&gt;
                       home.htm
                &lt;/welcome-file&gt;
         &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>/WEB-INF/tiles-servlet.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc= "http://www.springframework.org/schema/mvc"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-4.1.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"
  &gt; 
  
  &lt;context:component-scan base-package="com.test.controller"/&gt;
         &lt;mvc:annotation-driven/&gt;       
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>/WEB-INF/applicationContext.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc= "http://www.springframework.org/schema/mvc"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-4.1.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"
  &gt; 
  
  &lt;context:component-scan base-package="com.test.controller"/&gt;
         &lt;context:annotation-config/&gt;
         &lt;mvc:annotation-driven/&gt;  
  
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;property name="viewClass"&gt;
              &lt;value&gt;org.springframework.web.servlet.view.tiles3.TilesView&lt;/value&gt;
          &lt;/property&gt;        
      &lt;/bean&gt;
      &lt;bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"&gt;
          &lt;property name="definitions"&gt;
             &lt;list&gt;
                       &lt;value&gt;/WEB-INF/tiles/tilesJsp.xml&lt;/value&gt;
             &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>/WEB-INF/tiles/tilesJsp.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!DOCTYPE tiles-definitions PUBLIC
         "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
         "http://tiles.apache.org/dtds/tiles-config_3_0.dtd"&gt; 
  &lt;tiles-definition&gt;
      &lt;definition name="baseLayout" template="/WEB-INF/view/base.jsp"&gt;
         &lt;put-attribute name="title" value="Spring MVC And Tiles"/&gt; 
         &lt;put-attribute name="header" value="/WEB-INF/view/header.jsp"/&gt; 
         &lt;put-attribute name="menu" value="/WEB-INF/view/menu.jsp"/&gt;
         &lt;put-attribute name="body" value=""/&gt;
         &lt;put-attribute name="footer" value="/WEB-INF/view/footer.jsp"/&gt;
      &lt;/definition&gt;
  
      &lt;definition name="home" extends="baseLayout"&gt;
         &lt;put-attribute name="title" value="Home"/&gt;
         &lt;put-attribute name="body" value="/WEB-INF/view/home.jsp"/&gt;
      &lt;/definition&gt;
  
      &lt;definition name="page" extends="baseLayout"&gt;
         &lt;put-attribute name="title" value="Page"/&gt;
         &lt;put-attribute name="body" value="/WEB-INF/view/page.jsp"/&gt;
      &lt;/definition&gt;
  &lt;/tiles-definition&gt;
  </code></pre>
  
  <p><strong>/myproj/java resources/src/com/test/controller/HomeController.xml</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package com.test.controller;
  
  import javax.servlet.http.HttpServletRequest;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  
  @Controller
  public class HomeController {
  
      @RequestMapping("/home.htm")
      public String home(){
          System.out.println("Home");
          return "home";
      }
  
      @RequestMapping("/page.htm")
      public String page(@RequestParam(value="pageNo") String pageNo, HttpServletRequest request){
          System.out.println("Page No: "+pageNo);
          request.setAttribute("pageNo", pageNo);
          return "page";
      }
  }
  </code></pre>
  
  <p>The  <strong>/WEB-INF/view/</strong> contains the .jsp files.</p>