You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Aditya Saraf <ad...@gmail.com> on 2011/08/12 15:16:49 UTC

Null Container returned by getContainer

Hi,

I am trying to get the tiles definitions to work within folder. They seem to
be working on all root level files, but not inside folders. I am using the
BasicTilesContainer configuration with a tiles.xml file in the WEB-INF
folder. My error is as follows.

java.lang.NullPointerException
org.apache.tiles.template.InsertDefinitionModel.start(InsertDefinitionModel.java:74)
org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:276)

After attaching the source, I see that the line 217 in
org.apache.tiles.jsp.context.JspUtil.java calls getContainer(). Which in
turn calls an overloaded method of getContainer() on line 127 in the same
class. On line 127, I notice the following.

(TilesContainer) context.getAttribute(key,PageContext.*APPLICATION_SCOPE*);

I am suspecting that key is not being set or the attribute cannot be
retrieved given the appropriate key. They key should be set to
TilesAccess.CONTAINER_ATTRIBUTE. I guess someting in my Tomcat context is
not configured properly for this to not return the proper Tiles Container.
My web.xml looks like this

<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.xml
         </param-value>
     </init-param>
     <load-on-startup>2</load-on-startup>
 </servlet>

Do I need to specify some sort of a context param for the container to be
initialized and returned correctly? Please let me know.


Thanks,
Adi Saraf

Re: Null Container returned by getContainer

Posted by Aditya Saraf <ad...@gmail.com>.
I also suspect that the JspContext returned for the folders might be invalid
or null.

Thanks,
Adi Saraf

On Fri, Aug 12, 2011 at 9:41 AM, Aditya Saraf <ad...@gmail.com> wrote:

> I thought I did, but was looking in the wrong spot. Sorry :(
>
> Thanks,
> Adi Saraf
>
>   On Fri, Aug 12, 2011 at 9:36 AM, Antonio Petrelli <
> antonio.petrelli@gmail.com> wrote:
>
>> Uh didn't you solve the problem?
>>
>> 2011/8/12 Aditya Saraf <ad...@gmail.com>
>>
>> > Hi,
>> >
>> > I am trying to get the tiles definitions to work within folder. They
>> seem
>> > to
>> > be working on all root level files, but not inside folders. I am using
>> the
>> > BasicTilesContainer configuration with a tiles.xml file in the WEB-INF
>> > folder. My error is as follows.
>> >
>> > java.lang.NullPointerException
>> >
>> >
>> org.apache.tiles.template.InsertDefinitionModel.start(InsertDefinitionModel.java:74)
>> >
>> >
>> org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:276)
>> >
>> > After attaching the source, I see that the line 217 in
>> > org.apache.tiles.jsp.context.JspUtil.java calls getContainer(). Which in
>> > turn calls an overloaded method of getContainer() on line 127 in the
>> same
>> > class. On line 127, I notice the following.
>> >
>> > (TilesContainer)
>> context.getAttribute(key,PageContext.*APPLICATION_SCOPE*);
>> >
>> > I am suspecting that key is not being set or the attribute cannot be
>> > retrieved given the appropriate key. They key should be set to
>> > TilesAccess.CONTAINER_ATTRIBUTE. I guess someting in my Tomcat context
>> is
>> > not configured properly for this to not return the proper Tiles
>> Container.
>> > My web.xml looks like this
>> >
>> > <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.xml
>> >         </param-value>
>> >     </init-param>
>> >     <load-on-startup>2</load-on-startup>
>> >  </servlet>
>> >
>> > Do I need to specify some sort of a context param for the container to
>> be
>> > initialized and returned correctly? Please let me know.
>> >
>> >
>> > Thanks,
>> > Adi Saraf
>> >
>>
>
>
>
> --
> Adi Saraf
>



-- 
Adi Saraf

Re: Null Container returned by getContainer

Posted by Aditya Saraf <ad...@gmail.com>.
I thought I did, but was looking in the wrong spot. Sorry :(

Thanks,
Adi Saraf

On Fri, Aug 12, 2011 at 9:36 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> Uh didn't you solve the problem?
>
> 2011/8/12 Aditya Saraf <ad...@gmail.com>
>
> > Hi,
> >
> > I am trying to get the tiles definitions to work within folder. They seem
> > to
> > be working on all root level files, but not inside folders. I am using
> the
> > BasicTilesContainer configuration with a tiles.xml file in the WEB-INF
> > folder. My error is as follows.
> >
> > java.lang.NullPointerException
> >
> >
> org.apache.tiles.template.InsertDefinitionModel.start(InsertDefinitionModel.java:74)
> >
> >
> org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:276)
> >
> > After attaching the source, I see that the line 217 in
> > org.apache.tiles.jsp.context.JspUtil.java calls getContainer(). Which in
> > turn calls an overloaded method of getContainer() on line 127 in the same
> > class. On line 127, I notice the following.
> >
> > (TilesContainer)
> context.getAttribute(key,PageContext.*APPLICATION_SCOPE*);
> >
> > I am suspecting that key is not being set or the attribute cannot be
> > retrieved given the appropriate key. They key should be set to
> > TilesAccess.CONTAINER_ATTRIBUTE. I guess someting in my Tomcat context is
> > not configured properly for this to not return the proper Tiles
> Container.
> > My web.xml looks like this
> >
> > <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.xml
> >         </param-value>
> >     </init-param>
> >     <load-on-startup>2</load-on-startup>
> >  </servlet>
> >
> > Do I need to specify some sort of a context param for the container to be
> > initialized and returned correctly? Please let me know.
> >
> >
> > Thanks,
> > Adi Saraf
> >
>



-- 
Adi Saraf

Re: Null Container returned by getContainer

Posted by Antonio Petrelli <an...@gmail.com>.
Uh didn't you solve the problem?

2011/8/12 Aditya Saraf <ad...@gmail.com>

> Hi,
>
> I am trying to get the tiles definitions to work within folder. They seem
> to
> be working on all root level files, but not inside folders. I am using the
> BasicTilesContainer configuration with a tiles.xml file in the WEB-INF
> folder. My error is as follows.
>
> java.lang.NullPointerException
>
> org.apache.tiles.template.InsertDefinitionModel.start(InsertDefinitionModel.java:74)
>
> org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:276)
>
> After attaching the source, I see that the line 217 in
> org.apache.tiles.jsp.context.JspUtil.java calls getContainer(). Which in
> turn calls an overloaded method of getContainer() on line 127 in the same
> class. On line 127, I notice the following.
>
> (TilesContainer) context.getAttribute(key,PageContext.*APPLICATION_SCOPE*);
>
> I am suspecting that key is not being set or the attribute cannot be
> retrieved given the appropriate key. They key should be set to
> TilesAccess.CONTAINER_ATTRIBUTE. I guess someting in my Tomcat context is
> not configured properly for this to not return the proper Tiles Container.
> My web.xml looks like this
>
> <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.xml
>         </param-value>
>     </init-param>
>     <load-on-startup>2</load-on-startup>
>  </servlet>
>
> Do I need to specify some sort of a context param for the container to be
> initialized and returned correctly? Please let me know.
>
>
> Thanks,
> Adi Saraf
>