title: Using Thymeleaf with Tiles2 and Spring
body: <p>I'm trying to use <a href="https://github.com/thymeleaf/thymeleaf-extras-tiles2" rel="nofollow">Thymeleaf integration with Apache Tiles 2.x</a>. They have a guide how to make it work so I followed it, but now I'm stuck.</p>
  
  <p>Basically this integration allows using both JSPs and Thymeleaf templates and according to the guide, you should be able to tell which to use by setting the <code>type</code> attribute in your title-definition files. Default option is Thymeleaf.</p>
  
  <p>Because I am slowly migrating from JSP, the vast majority of the templates are JSPs, so I need to use this <code>type</code> attribute, but then I get an error that my title definition file is not valid:</p>
  
  <pre><code>org.apache.tiles.definition.DefinitionsFactoryException: XML error reading definitions.
  at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:332)
  at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.loadDefinitionsFromURL(BaseLocaleUrlDefinitionDAO.java:276)
  at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:251)
  at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
  at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadParentDefinitions(ResolvingLocaleUrlDefinitionDAO.java:58)
  at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:239)
  at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
  ...
  </code></pre>
  
  <p>This is my tiles definition file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE tiles-definitions PUBLIC
         "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
         "http://tiles.apache.org/dtds/tiles-config_2_1.dtd"&gt;
  
  &lt;tiles-definitions&gt;
      &lt;definition name="default" template="/WEB-INF/layouts/default.jspx" type="jsp"&gt;
      &lt;/definition&gt;
  &lt;/tiles-definitions&gt;
  </code></pre>
  
  <p>If I remove <code>DOCTYPE</code> part, I got same error.</p>
  
  <p>Any idea how to get it working?</p>