You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by John Norvell <no...@cox.net> on 2008/11/05 21:14:57 UTC

[t2] NullPointerException in UrlHelper issue with nested tiles

Here is an open issue in struts2 tiles plugin:
https://issues.apache.org/struts/browse/WW-2762

that is a critical issue for me.   I would like to help resolve this 
issue, but am not sure about the root cause.

Here is the issue in summary:

If you create a tile definition whose JSP page contains a struts2 
<s:form>, and if that tile page inserts a subtile page that contains 
form controls,  then the page will not render and a NullPointerException 
will be thrown from the org.apache.struts2.views.util.UrlHelper class.   
Attached to the JIRA is a very small sample that illustrates this issue.

I have run this in the debugger and have found that this line of code 
throwing the NPE:

UrlHelper.java:85

        // FIXME: temporary hack until class is made a properly injected 
bean
        Container cont = ActionContext.getContext().getContainer();

The xwork2.ActionContext.getContext() is returning null.

I have also found that in the reproducible test case, that this function 
is called twice, once per thread.  The first time that it is called 
ActionContext.getContext()  returns a valid context object and 
everything is fine.  But in the second invocation, getContext() returns 
null.

The actionContext is a ThreadLocal.  So somehow the ActionContext's 
internal actionContext is null for one of these two threads.   I'm not 
sure why or what exactly each of these two threads are responsible for.

Any suggestions for correcting this would be appreciated.

Thanks,
John





Re: [t2] NullPointerException in UrlHelper issue with nested tiles

Posted by Antonio <an...@gmail.com>.
2008/11/5 John Norvell <no...@cox.net>:
> Here is an open issue in struts2 tiles plugin:
> https://issues.apache.org/struts/browse/WW-2762

This is a Struts 2/Tiles 2 plugin bug, ask to the Struts Users mailing list:
http://struts.apache.org/mail.html

Antonio