You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Andy T <ve...@gmail.com> on 2009/10/30 04:24:40 UTC

TilesContainer Not Intialized Problem

Hi All,

I'm trying to apply Tiles in my Struts application for the first time
and I'm getting this error:  "javax.servlet.ServletException:
TilesContainer not initialized" when I execute test.jsp.  I'm using
Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
are shown below.

I was wondering if anyone could help me out here . . .

Thanks,

Rob

**************  Web.xml *********************************

[code]
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.3" xmlns="http://java.sun.com/xml/
ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/
xml/ns/j2ee/web-app_2_3.xsd">
        <display-name></display-name>
        <servlet>
                <servlet-name>action</servlet-name>
                <servlet-class>org.apache.struts.action.ActionServlet</
servlet-
class>

                <init-param>
                        <param-name>config</param-name>
                        <param-value>/WEB-INF/struts-config.xml</param-
value>
                </init-param>
                <init-param>
                        <param-name>debug</param-name>
                        <param-value>2</param-value>
                </init-param>
                <init-param>
                        <param-name>detail</param-name>
                        <param-value>2</param-value>
                </init-param>
                <init-param>
                        <param-name>validate</param-name>
                        <param-value>true</param-value>
                </init-param>
                <load-on-startup>2</load-on-startup>

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

                    <init-param>
                                <param-name>chainConfig</param-name>
                                <param-value>org/apache/struts/tiles/
chain-config.xml</param-
value>
                        </init-param>

                    <init-param>
                        <param-name>

org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG
                        </param-name>
                        <param-value>
                          /WEB-INF/tiles-defs.xml,/org/apache/tiles/
classpath-
defs.xml
                        </param-value>
                    </init-param>
                    <load-on-startup>1</load-on-startup>
           </servlet>

        </servlet>
        <servlet-mapping>
                <servlet-name>action</servlet-name>
                <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                <welcome-file>default.html</welcome-file>
                <welcome-file>default.htm</welcome-file>
                <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>

</web-app>
[/code]

**************  struts-config.xml *********************************

[code]
        <plug-in className="net.sf.navigator.menu.MenuPlugIn">
                <set-property property="menuConfig" value="/WEB-INF/
menu-
config.xml"/>
        </plug-in>

        <plug-in className="org.apache.struts.tiles.TilesPlugin" >
                <set-property property="definitionsconfig" value="/WEB-
INF/tiles-
defs.xml" />
                <set-property property="moduleAware" value="true" />
        </plug-in>
[/code]

*****************  test.jsp ***************************

[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@page
        language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>

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

<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
</head>
<body>
        <tiles:insertDefinition name="homePage" />
</body>
</html>
[/code]

*****************************  tiles-defs.xml
*******************************

[code]

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//
EN"
       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">

<tiles-definitions>

    <definition name="homePage" template="/layouts/template.jsp">
            <put-attribute name="title" value="Tiles tutorial
homepage" />
            <put-attribute name="menu" value="/menu.jsp" />
            <put-attribute name="leftnav" value="/leftnav.jsp" />
            <put-attribute name="body" value="/body.jsp" />
            <put-attribute name="footer" value="/footer.jsp" />
        </definition>

</tiles-definitions>

[/code]

*********************  template.jsp **********************

[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@page
        language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>

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

<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title><tiles:getAsString name="title"/></title>
</head>
<body>
  <table>
      <tr>
        <td colspan="2">
          <tiles:insertAttribute name="header" />
        </td>
      </tr>
      <tr>
        <td>
          <tiles:insertAttribute name="menu" />
        </td>
        <td>
          <tiles:insertAttribute name="body" />
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <tiles:insertAttribute name="footer" />
        </td>
      </tr>
    </table>

</body>
</html>
[/code]

RE: TilesContainer Not Intialized Problem

Posted by Brian Stewart <Br...@ahom.com>.
My Bad Andy,

You also need the configuration for the stdout appender.  Here is what I use...
# configuration for the console appender 
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-5p [%d] (%c:%L) - %m%n

Regards,
Brian 
mrbcstewart@yahoo.com

-----Original Message-----
From: Andy T [mailto:verygoofyone@gmail.com] 
Sent: Friday, October 30, 2009 8:29 AM
To: users@tiles.apache.org
Subject: Re: TilesContainer Not Intialized Problem

Hi Brian,

I replaced the line as you suggested and restarted Tomcat but unfortunately
I still get the same error:

log4j:ERROR Could not find value for key log4j.appender.stdout

Thanks,
Andy

On Fri, Oct 30, 2009 at 9:15 AM, Brian Stewart <Br...@ahom.com>wrote:

> Just add ", stdout" to the top line in your log4j.properties file.
>
> Should look like...
> log4j.rootLogger=DEBUG, testAppender, stdout
>
> Regards,
> Brian
> mrbcstewart@yahoo.com
>
> -----Original Message-----
> From: Andy T [mailto:verygoofyone@gmail.com]
> Sent: Friday, October 30, 2009 8:12 AM
> To: users@tiles.apache.org
> Subject: Re: TilesContainer Not Intialized Problem
>
> Hi Antonio,
>
> Thank you for responding to my question . . .
>
> I'm new to all this and my logger is not properly configured so I'm working
> on this . . .
>
> Currently, I have a log4j.properties file and logging.properties file in
> WEB-INF/Classes Folder.  However, I'm not sure what the contents of these
> files should be . . . the current contents are shown below:
>
> ****************  log4j.properties ********************
>
> log4j.rootLogger=DEBUG, testAppender
>
> log4j.appender.testAppender=
> com.webmethods.sc.logging.log4j.WmDailyFileAppender
>
> log4j.appender.testAppender.file=log/test1.log
>
> log4j.appender.testAppender.datePattern='.'yyyy-MM-dd_HH_mm
>
> log4j.appender.testAppender.Append=false
>
> log4j.appender.testAppender.layout=com.webmethods.sc.log4j.PatternLayout
>
> log4j.appender.testAppender.layout.ConversionPattern=%m%n
>
> log4j.appender.testAppender.stdout.Target=System.out
>
>
>
> log4j.rootLogger=warn, stdout
>
> log4j.logger.org.hibernate=debug
>
> log4j.logger.org.hibernate.type=info
>
> log4j.logger.org.hibernate.tool.hbm2ddl=debug
>
> ******************************  logging.properties
> **************************
>
> handlers = *org*.*apache*.*juli*.FileHandler, java.*util*
> .logging.ConsoleHandler
>
> ############################################################
>
> # Handler specific properties.
>
> # Describes specific configuration info for Handlers.
>
> ############################################################
>
> org.apache.juli.FileHandler.level = FINE
>
> org.apache.juli.FileHandler.directory = ${*catalina*.base}/logs
>
> org.apache.juli.FileHandler.prefix = *servlet*-examples.
>
> java.util.logging.ConsoleHandler.level = FINE
>
> java.util.logging.ConsoleHandler.formatter = java.*util*
> .logging.SimpleFormatter
>
>
>
> I get these messages when I start Tomcat 5.5:
>
> log4j:ERROR Could not find value for key log4j.appender.stdout
>
> log4j:ERROR Could not instantiate appender named "stdout".
>
> log4j:WARN No appenders could be found for logger
> (org.apache.commons.digester.Digester).
>
> log4j:WARN Please initialize the log4j system properly.
>
> Can you assist me in configuring the logger correctly?
>
> Thanks,
>
> Andy
>
>
>
>
>
>
>
> On Fri, Oct 30, 2009 at 3:55 AM, Antonio Petrelli <
> antonio.petrelli@gmail.com> wrote:
>
> > 2009/10/30 Antonio Petrelli <an...@gmail.com>:
> >  > 2009/10/30 Andy T <ve...@gmail.com>:
> > >> I'm trying to apply Tiles in my Struts application for the first time
> > >> and I'm getting this error:  "javax.servlet.ServletException:
> > >> TilesContainer not initialized" when I execute test.jsp.  I'm using
> > >> Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
> > >> are shown below.
> > >
> > > Please post your log.
> >
> > I meant the *entire* log, from the start of the webapp to the error.
> >
> > Antonio
> >
> This message is confidential, intended only for the named recipient
> and may contain information that is privileged or exempt from
> disclosure under applicable law.  If you are not the intended
> recipient, you are notified that the dissemination, distribution or
> copying of this message is strictly prohibited.  If you receive
> this message in error, or are not the named recipient, please
> notify the sender at the email address listed above.
>
>

Re: TilesContainer Not Intialized Problem

Posted by Andy T <ve...@gmail.com>.
Hi Brian,

I replaced the line as you suggested and restarted Tomcat but unfortunately
I still get the same error:

log4j:ERROR Could not find value for key log4j.appender.stdout

Thanks,
Andy

On Fri, Oct 30, 2009 at 9:15 AM, Brian Stewart <Br...@ahom.com>wrote:

> Just add ", stdout" to the top line in your log4j.properties file.
>
> Should look like...
> log4j.rootLogger=DEBUG, testAppender, stdout
>
> Regards,
> Brian
> mrbcstewart@yahoo.com
>
> -----Original Message-----
> From: Andy T [mailto:verygoofyone@gmail.com]
> Sent: Friday, October 30, 2009 8:12 AM
> To: users@tiles.apache.org
> Subject: Re: TilesContainer Not Intialized Problem
>
> Hi Antonio,
>
> Thank you for responding to my question . . .
>
> I'm new to all this and my logger is not properly configured so I'm working
> on this . . .
>
> Currently, I have a log4j.properties file and logging.properties file in
> WEB-INF/Classes Folder.  However, I'm not sure what the contents of these
> files should be . . . the current contents are shown below:
>
> ****************  log4j.properties ********************
>
> log4j.rootLogger=DEBUG, testAppender
>
> log4j.appender.testAppender=
> com.webmethods.sc.logging.log4j.WmDailyFileAppender
>
> log4j.appender.testAppender.file=log/test1.log
>
> log4j.appender.testAppender.datePattern='.'yyyy-MM-dd_HH_mm
>
> log4j.appender.testAppender.Append=false
>
> log4j.appender.testAppender.layout=com.webmethods.sc.log4j.PatternLayout
>
> log4j.appender.testAppender.layout.ConversionPattern=%m%n
>
> log4j.appender.testAppender.stdout.Target=System.out
>
>
>
> log4j.rootLogger=warn, stdout
>
> log4j.logger.org.hibernate=debug
>
> log4j.logger.org.hibernate.type=info
>
> log4j.logger.org.hibernate.tool.hbm2ddl=debug
>
> ******************************  logging.properties
> **************************
>
> handlers = *org*.*apache*.*juli*.FileHandler, java.*util*
> .logging.ConsoleHandler
>
> ############################################################
>
> # Handler specific properties.
>
> # Describes specific configuration info for Handlers.
>
> ############################################################
>
> org.apache.juli.FileHandler.level = FINE
>
> org.apache.juli.FileHandler.directory = ${*catalina*.base}/logs
>
> org.apache.juli.FileHandler.prefix = *servlet*-examples.
>
> java.util.logging.ConsoleHandler.level = FINE
>
> java.util.logging.ConsoleHandler.formatter = java.*util*
> .logging.SimpleFormatter
>
>
>
> I get these messages when I start Tomcat 5.5:
>
> log4j:ERROR Could not find value for key log4j.appender.stdout
>
> log4j:ERROR Could not instantiate appender named "stdout".
>
> log4j:WARN No appenders could be found for logger
> (org.apache.commons.digester.Digester).
>
> log4j:WARN Please initialize the log4j system properly.
>
> Can you assist me in configuring the logger correctly?
>
> Thanks,
>
> Andy
>
>
>
>
>
>
>
> On Fri, Oct 30, 2009 at 3:55 AM, Antonio Petrelli <
> antonio.petrelli@gmail.com> wrote:
>
> > 2009/10/30 Antonio Petrelli <an...@gmail.com>:
> >  > 2009/10/30 Andy T <ve...@gmail.com>:
> > >> I'm trying to apply Tiles in my Struts application for the first time
> > >> and I'm getting this error:  "javax.servlet.ServletException:
> > >> TilesContainer not initialized" when I execute test.jsp.  I'm using
> > >> Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
> > >> are shown below.
> > >
> > > Please post your log.
> >
> > I meant the *entire* log, from the start of the webapp to the error.
> >
> > Antonio
> >
> This message is confidential, intended only for the named recipient
> and may contain information that is privileged or exempt from
> disclosure under applicable law.  If you are not the intended
> recipient, you are notified that the dissemination, distribution or
> copying of this message is strictly prohibited.  If you receive
> this message in error, or are not the named recipient, please
> notify the sender at the email address listed above.
>
>

RE: TilesContainer Not Intialized Problem

Posted by Brian Stewart <Br...@ahom.com>.
Just add ", stdout" to the top line in your log4j.properties file.

Should look like...
log4j.rootLogger=DEBUG, testAppender, stdout

Regards,
Brian 
mrbcstewart@yahoo.com

-----Original Message-----
From: Andy T [mailto:verygoofyone@gmail.com] 
Sent: Friday, October 30, 2009 8:12 AM
To: users@tiles.apache.org
Subject: Re: TilesContainer Not Intialized Problem

Hi Antonio,

Thank you for responding to my question . . .

I'm new to all this and my logger is not properly configured so I'm working
on this . . .

Currently, I have a log4j.properties file and logging.properties file in
WEB-INF/Classes Folder.  However, I'm not sure what the contents of these
files should be . . . the current contents are shown below:

****************  log4j.properties ********************

log4j.rootLogger=DEBUG, testAppender

log4j.appender.testAppender=
com.webmethods.sc.logging.log4j.WmDailyFileAppender

log4j.appender.testAppender.file=log/test1.log

log4j.appender.testAppender.datePattern='.'yyyy-MM-dd_HH_mm

log4j.appender.testAppender.Append=false

log4j.appender.testAppender.layout=com.webmethods.sc.log4j.PatternLayout

log4j.appender.testAppender.layout.ConversionPattern=%m%n

log4j.appender.testAppender.stdout.Target=System.out



log4j.rootLogger=warn, stdout

log4j.logger.org.hibernate=debug

log4j.logger.org.hibernate.type=info

log4j.logger.org.hibernate.tool.hbm2ddl=debug

******************************  logging.properties
**************************

handlers = *org*.*apache*.*juli*.FileHandler, java.*util*
.logging.ConsoleHandler

############################################################

# Handler specific properties.

# Describes specific configuration info for Handlers.

############################################################

org.apache.juli.FileHandler.level = FINE

org.apache.juli.FileHandler.directory = ${*catalina*.base}/logs

org.apache.juli.FileHandler.prefix = *servlet*-examples.

java.util.logging.ConsoleHandler.level = FINE

java.util.logging.ConsoleHandler.formatter = java.*util*
.logging.SimpleFormatter



I get these messages when I start Tomcat 5.5:

log4j:ERROR Could not find value for key log4j.appender.stdout

log4j:ERROR Could not instantiate appender named "stdout".

log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester).

log4j:WARN Please initialize the log4j system properly.

Can you assist me in configuring the logger correctly?

Thanks,

Andy







On Fri, Oct 30, 2009 at 3:55 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2009/10/30 Antonio Petrelli <an...@gmail.com>:
>  > 2009/10/30 Andy T <ve...@gmail.com>:
> >> I'm trying to apply Tiles in my Struts application for the first time
> >> and I'm getting this error:  "javax.servlet.ServletException:
> >> TilesContainer not initialized" when I execute test.jsp.  I'm using
> >> Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
> >> are shown below.
> >
> > Please post your log.
>
> I meant the *entire* log, from the start of the webapp to the error.
>
> Antonio
>
This message is confidential, intended only for the named recipient
and may contain information that is privileged or exempt from
disclosure under applicable law.  If you are not the intended
recipient, you are notified that the dissemination, distribution or
copying of this message is strictly prohibited.  If you receive
this message in error, or are not the named recipient, please
notify the sender at the email address listed above.


Re: TilesContainer Not Intialized Problem

Posted by Andy T <ve...@gmail.com>.
Hi Antonio,

Thank you for responding to my question . . .

I'm new to all this and my logger is not properly configured so I'm working
on this . . .

Currently, I have a log4j.properties file and logging.properties file in
WEB-INF/Classes Folder.  However, I'm not sure what the contents of these
files should be . . . the current contents are shown below:

****************  log4j.properties ********************

log4j.rootLogger=DEBUG, testAppender

log4j.appender.testAppender=
com.webmethods.sc.logging.log4j.WmDailyFileAppender

log4j.appender.testAppender.file=log/test1.log

log4j.appender.testAppender.datePattern='.'yyyy-MM-dd_HH_mm

log4j.appender.testAppender.Append=false

log4j.appender.testAppender.layout=com.webmethods.sc.log4j.PatternLayout

log4j.appender.testAppender.layout.ConversionPattern=%m%n

log4j.appender.testAppender.stdout.Target=System.out



log4j.rootLogger=warn, stdout

log4j.logger.org.hibernate=debug

log4j.logger.org.hibernate.type=info

log4j.logger.org.hibernate.tool.hbm2ddl=debug

******************************  logging.properties
**************************

handlers = *org*.*apache*.*juli*.FileHandler, java.*util*
.logging.ConsoleHandler

############################################################

# Handler specific properties.

# Describes specific configuration info for Handlers.

############################################################

org.apache.juli.FileHandler.level = FINE

org.apache.juli.FileHandler.directory = ${*catalina*.base}/logs

org.apache.juli.FileHandler.prefix = *servlet*-examples.

java.util.logging.ConsoleHandler.level = FINE

java.util.logging.ConsoleHandler.formatter = java.*util*
.logging.SimpleFormatter



I get these messages when I start Tomcat 5.5:

log4j:ERROR Could not find value for key log4j.appender.stdout

log4j:ERROR Could not instantiate appender named "stdout".

log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester).

log4j:WARN Please initialize the log4j system properly.

Can you assist me in configuring the logger correctly?

Thanks,

Andy







On Fri, Oct 30, 2009 at 3:55 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2009/10/30 Antonio Petrelli <an...@gmail.com>:
>  > 2009/10/30 Andy T <ve...@gmail.com>:
> >> I'm trying to apply Tiles in my Struts application for the first time
> >> and I'm getting this error:  "javax.servlet.ServletException:
> >> TilesContainer not initialized" when I execute test.jsp.  I'm using
> >> Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
> >> are shown below.
> >
> > Please post your log.
>
> I meant the *entire* log, from the start of the webapp to the error.
>
> Antonio
>

Re: TilesContainer Not Intialized Problem

Posted by Antonio Petrelli <an...@gmail.com>.
2009/10/30 Antonio Petrelli <an...@gmail.com>:
> 2009/10/30 Andy T <ve...@gmail.com>:
>> I'm trying to apply Tiles in my Struts application for the first time
>> and I'm getting this error:  "javax.servlet.ServletException:
>> TilesContainer not initialized" when I execute test.jsp.  I'm using
>> Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
>> are shown below.
>
> Please post your log.

I meant the *entire* log, from the start of the webapp to the error.

Antonio

Re: TilesContainer Not Intialized Problem

Posted by Antonio Petrelli <an...@gmail.com>.
2009/10/30 Andy T <ve...@gmail.com>:
> I got the logging and tiles working now . . .
>
> Brian helped me with the logging and I was able to see what the problem was
> once the logging was working . . .

Just for curiosity, what was your problem?

Antonio

Re: TilesContainer Not Intialized Problem

Posted by Andy T <ve...@gmail.com>.
Hi Antonio,

I got the logging and tiles working now . . .

Brian helped me with the logging and I was able to see what the problem was
once the logging was working . . .

Thanks so much for your offer of help . . .

Andy

On Fri, Oct 30, 2009 at 3:55 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2009/10/30 Andy T <ve...@gmail.com>:
> > I'm trying to apply Tiles in my Struts application for the first time
> > and I'm getting this error:  "javax.servlet.ServletException:
> > TilesContainer not initialized" when I execute test.jsp.  I'm using
> > Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
> > are shown below.
>
> Please post your log.
>
> Antonio
>

Re: TilesContainer Not Intialized Problem

Posted by Antonio Petrelli <an...@gmail.com>.
2009/10/30 Andy T <ve...@gmail.com>:
> I'm trying to apply Tiles in my Struts application for the first time
> and I'm getting this error:  "javax.servlet.ServletException:
> TilesContainer not initialized" when I execute test.jsp.  I'm using
> Struts 1.3 and Tiles 2.1.3.  Relevant code snippets of various files
> are shown below.

Please post your log.

Antonio