Announcement Announcement Module
Collapse
No announcement yet.
tiles2 fails to initialize Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • tiles2 fails to initialize

    I know this is a general question, but does anyone know of a clear tutorial on how to set up a Spring2.5 / tiles2 setup?

    my problem, I try to deploy my war file and when it gets to initilizing the tiles2 container:

    Code:
    INFO: Initializing Tiles2 container. . .
    SEVERE: Context initialization failed


    then I get an exception:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in ServletContext resource [/WEB-INF/app-servlet.xml]: Invocation of init method failed; nested exception is org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definitions.
    	at
    my app-servlet.xml file defines the tileconfiger as such:
    Code:
    <bean id="urlMapping" 
    		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                </props>
            </property>
        </bean>
        
    	<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
          <list>
            <value>/WEB-INF/defs/tiles-def.xml</value>
          </list>
        </property>
      </bean>
    
    	<bean id="viewResolver" 
          class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="requestContextAttribute" value="requestContext"/>
        <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>      
      </bean>
    The weird thing is, it was working (well I couldn't get my tiles example to work, but at least it wasn't dying on me) a few days ago, but now I can't seem to get tiles2 to initialize. Anyone got any idea?

    JOhn

  • #2
    Well your exception should tell you something and actually it does.

    Code:
    org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definitions.
    So this either means the file isn't at the location where it is supposed to be or your file is screwed and it has an illegal format.

    Comment


    • #3
      the tiles-def.xml file?

      It is there, and it's pretty simple...

      Code:
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE tiles-definitions PUBLIC
             "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
             "<tiles 1-1 url>">
      <tiles-definitions>
      
        	<definition name="head-tile" path="/WEB-INF/jsp/tiles/header.jsp"/>
       
        <definition name="testlayout" template="/WEB-INF/jsp/template/template.jsp">
        	<put name="title" value="default title" type="string"/> 
        	<put name="header" value="head-tile"/>
        </definition>
        
      </tiles-definitions>

      nothing jumping out at me...

      Comment


      • #4
        I think you are trying to use the Tiles 1 DTD, not the Tiles 2 DTD.

        You need to update your XML headers to reference tiles-config_2_0.dtd. Replace <DTDURL> with your location for your DTDs or use tiles.apache.org/dtd/tiles-config_2_0.dtd

        (I can't post URLs due to some server restriction)

        Try using this header:
        Code:
        <!DOCTYPE tiles-definitions PUBLIC
        	        "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
                        "<DTDURL>/tiles-config_2_0.dtd">
        Regards,

        Kevin

        Comment


        • #5
          Yeah, kevin you hit that one on the head. I can't be 100% sure if that solved the issue or not (I ended up doing massive changes to the file), but that was indeed a big bug on my part.

          thanks for the help!

          Comment

          Working...
          X