You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Horacio Tovar <he...@hotmail.com> on 2009/08/24 20:33:47 UTC

Please Help with this problem ...

Please help!!! Thank you!

Hi, I’ve fallowed the resolution for this problem posted here, but I am still having the “TilesContainer not initialized” exception. I am posting here my codes to see if you find any error. I have 2 days trying to find out what is the problem.

 

tiles-defs.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE root PUBLIC 

    "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 2.0//EN"

    "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

 

<tiles-definitions>

    <definition name="myapp.homepage" template="/layouts/classic.jsp">

        <put-attribute name="title" value="Tiles tutorial homepage" />

        <put-attribute name="header" value="/tiles/banner.jsp" />

        <put-attribute name="menu" value="/tiles/menu.jsp" />

        <put-attribute name="body" value="/tiles/body.jsp" />

        <put-attribute name="footer" value="/tiles/footer.jsp" />

    </definition>

</tiles-definitions>

 

 

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <filter>

        <filter-name>struts2</filter-name>

        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

    </filter>

    <servlet>

        <servlet-name>tiles</servlet-name>

        <servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>

        <init-param>

            <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>

            <param-value>/WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml</param-value>

        </init-param>

        <load-on-startup>2</load-on-startup>

    </servlet>

    <filter-mapping>

        <filter-name>struts2</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

    <session-config>

        <session-timeout>

            30

        </session-timeout>

    </session-config>

    <welcome-file-list>

        <welcome-file>somepage.jsp</welcome-file>

    </welcome-file-list>

</web-app>

 

Somepage.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<%@ page import="org.apache.tiles.TilesContainer"%>

<%@ page import="org.apache.tiles.access.TilesAccess"%>

 

<tiles:insertDefinition name="myapp.homepage" />

 

<% try

    {

        TilesContainer container = TilesAccess.getContainer(request

            .getSession().getServletContext());

        container.render("myapp.homepage", request, response);

    }

    catch(Exception e) { e.printStackTrace(); }

%>

 

Aug 24, 2009 2:25:05 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register

INFO: Parsing configuration file [struts-default.xml]

Aug 24, 2009 2:25:06 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register

INFO: Parsing configuration file [struts-plugin.xml]

Aug 24, 2009 2:25:06 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register

INFO: Parsing configuration file [struts.xml]

Aug 24, 2009 2:25:06 PM org.apache.struts2.config.Settings getLocale

WARNING: Settings: Could not parse struts.locale setting, substituting default VM locale

Aug 24, 2009 2:25:12 PM com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>

INFO: Setting DefaultObjectTypeDeterminer as default ...

Aug 24, 2009 2:25:12 PM org.apache.tiles.context.AbstractTilesApplicationContextFactory createFactory

INFO: Initializing Tiles2 application context. . .

Aug 24, 2009 2:25:12 PM org.apache.tiles.context.AbstractTilesApplicationContextFactory createFactory

INFO: Finished initializing Tiles2 application context.

Aug 24, 2009 2:25:12 PM org.apache.tiles.factory.TilesContainerFactory initializeContainer

INFO: Initializing Tiles2 container. . .

Aug 24, 2009 2:25:12 PM org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO identifySources

WARNING: Unable to find configured definition '/org/apache/tiles/classpath-defs.xml'

Aug 24, 2009 2:25:29 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register

INFO: Parsing configuration file [struts-default.xml]

Aug 24, 2009 2:25:29 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register

INFO: Parsing configuration file [struts-plugin.xml]

Aug 24, 2009 2:25:29 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register

INFO: Parsing configuration file [struts.xml]

Aug 24, 2009 2:25:29 PM org.apache.struts2.config.Settings getLocale

WARNING: Settings: Could not parse struts.locale setting, substituting default VM locale

Aug 24, 2009 2:25:30 PM com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>

INFO: Setting DefaultObjectTypeDeterminer as default ...

Aug 24, 2009 2:25:30 PM org.apache.tiles.context.AbstractTilesApplicationContextFactory createFactory

INFO: Initializing Tiles2 application context. . .

Aug 24, 2009 2:25:30 PM org.apache.tiles.context.AbstractTilesApplicationContextFactory createFactory

INFO: Finished initializing Tiles2 application context.

Aug 24, 2009 2:25:30 PM org.apache.tiles.factory.TilesContainerFactory initializeContainer

INFO: Initializing Tiles2 container. . .

Aug 24, 2009 2:25:31 PM org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO identifySources

WARNING: Unable to find configured definition '/org/apache/tiles/classpath-defs.xml'

 

Let me know if you need more info …

 

Thank you!

 

Hetch


---------------------- Horacio Tovar


_________________________________________________________________
Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_facebook:082009

RE: Please Help with this problem ...

Posted by "Griffith, Michael *" <Mi...@fda.hhs.gov>.
The last line shows your problem:
Unable to find configured definition
'/org/apache/tiles/classpath-defs.xml

It can't find the tiles definition file. In your deployed application,
the classpath starts under WEB-INF/classes. So, using this package
structure, you should have a file called classpath-defs.xml located at
WEB-INF/classes/org/apache/tiles.

I'd loose the directory/package info and place the file directly in the
webroot /WEB-INF/classes directory.

MG 

-----Original Message-----
From: Horacio Tovar [mailto:hetch_97@hotmail.com] 
Sent: Monday, August 24, 2009 1:34 PM
To: users@tiles.apache.org; antonio.petrelli@gmail.com
Subject: Please Help with this problem ...


Please help!!! Thank you!

Hi, I've fallowed the resolution for this problem posted here, but I am
still having the "TilesContainer not initialized" exception. I am
posting here my codes to see if you find any error. I have 2 days trying
to find out what is the problem.

 

tiles-defs.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE root PUBLIC 

    "-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 2.0//EN"

    "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

 

<tiles-definitions>

    <definition name="myapp.homepage" template="/layouts/classic.jsp">

        <put-attribute name="title" value="Tiles tutorial homepage" />

        <put-attribute name="header" value="/tiles/banner.jsp" />

        <put-attribute name="menu" value="/tiles/menu.jsp" />

        <put-attribute name="body" value="/tiles/body.jsp" />

        <put-attribute name="footer" value="/tiles/footer.jsp" />

    </definition>

</tiles-definitions>

 

 

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <filter>

        <filter-name>struts2</filter-name>

 
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-cla
ss>

    </filter>

    <servlet>

        <servlet-name>tiles</servlet-name>

 
<servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>

        <init-param>

 
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>

 
<param-value>/WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xm
l</param-value>

        </init-param>

        <load-on-startup>2</load-on-startup>

    </servlet>

    <filter-mapping>

        <filter-name>struts2</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

    <session-config>

        <session-timeout>

            30

        </session-timeout>

    </session-config>

    <welcome-file-list>

        <welcome-file>somepage.jsp</welcome-file>

    </welcome-file-list>

</web-app>

 

Somepage.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<%@ page import="org.apache.tiles.TilesContainer"%>

<%@ page import="org.apache.tiles.access.TilesAccess"%>

 

<tiles:insertDefinition name="myapp.homepage" />

 

<% try

    {

        TilesContainer container = TilesAccess.getContainer(request

            .getSession().getServletContext());

        container.render("myapp.homepage", request, response);

    }

    catch(Exception e) { e.printStackTrace(); }

%>

 

Aug 24, 2009 2:25:05 PM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
register

INFO: Parsing configuration file [struts-default.xml]

Aug 24, 2009 2:25:06 PM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
register

INFO: Parsing configuration file [struts-plugin.xml]

Aug 24, 2009 2:25:06 PM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
register

INFO: Parsing configuration file [struts.xml]

Aug 24, 2009 2:25:06 PM org.apache.struts2.config.Settings getLocale

WARNING: Settings: Could not parse struts.locale setting, substituting
default VM locale

Aug 24, 2009 2:25:12 PM
com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>

INFO: Setting DefaultObjectTypeDeterminer as default ...

Aug 24, 2009 2:25:12 PM
org.apache.tiles.context.AbstractTilesApplicationContextFactory
createFactory

INFO: Initializing Tiles2 application context. . .

Aug 24, 2009 2:25:12 PM
org.apache.tiles.context.AbstractTilesApplicationContextFactory
createFactory

INFO: Finished initializing Tiles2 application context.

Aug 24, 2009 2:25:12 PM org.apache.tiles.factory.TilesContainerFactory
initializeContainer

INFO: Initializing Tiles2 container. . .

Aug 24, 2009 2:25:12 PM
org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO
identifySources

WARNING: Unable to find configured definition
'/org/apache/tiles/classpath-defs.xml'

Aug 24, 2009 2:25:29 PM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
register

INFO: Parsing configuration file [struts-default.xml]

Aug 24, 2009 2:25:29 PM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
register

INFO: Parsing configuration file [struts-plugin.xml]

Aug 24, 2009 2:25:29 PM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
register

INFO: Parsing configuration file [struts.xml]

Aug 24, 2009 2:25:29 PM org.apache.struts2.config.Settings getLocale

WARNING: Settings: Could not parse struts.locale setting, substituting
default VM locale

Aug 24, 2009 2:25:30 PM
com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>

INFO: Setting DefaultObjectTypeDeterminer as default ...

Aug 24, 2009 2:25:30 PM
org.apache.tiles.context.AbstractTilesApplicationContextFactory
createFactory

INFO: Initializing Tiles2 application context. . .

Aug 24, 2009 2:25:30 PM
org.apache.tiles.context.AbstractTilesApplicationContextFactory
createFactory

INFO: Finished initializing Tiles2 application context.

Aug 24, 2009 2:25:30 PM org.apache.tiles.factory.TilesContainerFactory
initializeContainer

INFO: Initializing Tiles2 container. . .

Aug 24, 2009 2:25:31 PM
org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO
identifySources

WARNING: Unable to find configured definition
'/org/apache/tiles/classpath-defs.xml'

 

Let me know if you need more info ...

 

Thank you!

 

Hetch


---------------------- Horacio Tovar


_________________________________________________________________
Windows Live: Make it easier for your friends to see what you're up to
on Facebook.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAG
L:ON:WL:en-US:SI_SB_facebook:082009