Results 1 to 5 of 5

Thread: tiles2 fails to initialize

  1. #1
    Join Date
    Jul 2008
    Posts
    18

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2008
    Posts
    18

    Default

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

  4. #4
    Join Date
    May 2007
    Location
    Ottawa, Canada
    Posts
    10

    Default

    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

  5. #5
    Join Date
    Jul 2008
    Posts
    18

    Default

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •