You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Felix Röthenbacher (JIRA)" <de...@myfaces.apache.org> on 2009/01/23 04:47:02 UTC
[jira] Created: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
NullPointerException because RequestContext released after action request.
--------------------------------------------------------------------------
Key: TRINIDAD-1376
URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
Project: MyFaces Trinidad
Issue Type: Bug
Components: Portlet
Affects Versions: 1.2.11-core
Reporter: Felix Röthenbacher
RequestContext is released after action request which results in a NullPointerException in the following render request.
The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Scott O'Bryan (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667318#action_12667318 ]
Scott O'Bryan commented on TRINIDAD-1376:
-----------------------------------------
The RequestContext should be released and re-created each request. By spec, request scoped attributes DO NOT have to carry over from an Action to a Render. The global configurator will run again in the action phase and restore this object. Currently this logic works fine with the JSR-301 Portlet Bridge. Can you provide an example which illustrates your issue?
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Felix Röthenbacher (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667452#action_12667452 ]
Felix Röthenbacher commented on TRINIDAD-1376:
----------------------------------------------
The RequestContext object is released after action phase and not re-created for render phase. The call of RequestContext.getCurrentInstance() in RenderKitDecorator (line 119) throws a NullPointerException.
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Felix Röthenbacher (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671711#action_12671711 ]
Felix Röthenbacher commented on TRINIDAD-1376:
----------------------------------------------
I quickly tested your patch and it seems ok to me. I used the current snapshot version of the portlet-bridge for testing for various reasons. I also had to add a Javascript trigger to execute the method usually triggered by body onload(). This method is not executed in a portlet environment and leaves Trinidad thinking PPR can be used but PPR does not work in a portlet environment yet.
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Attachments: TRINIDAD-1376-patch.txt, TRINIDAD-1376.patch
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Scott O'Bryan (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667506#action_12667506 ]
Scott O'Bryan commented on TRINIDAD-1376:
-----------------------------------------
The RenderKitDecorator logic might be new and we might need to trace down and revisit the dependency. But the RequestContext needs to be released at every phase. Neither the request scope nor the thread are guaranteed to be the same between action and render.
What I find curious, however, is that it works for some of the Trinidad extensions we've een working on.
Scott
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Felix Röthenbacher (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667586#action_12667586 ]
Felix Röthenbacher commented on TRINIDAD-1376:
----------------------------------------------
The problem was that the RequestContext was not properly re-created. beginRequest() did not correctly initialize and attach a new RequestContext because RequestType.getType() returned still PORTAL_ACTION (saved and restored by the portlet bridge). After solving this by adding the @ExcludeFromManagedRequestScope annotation to the RequestType class another problem appeared. Attaching a RequestContext (GlobalConfiguratorImpl:448) used a cached RequestContext from the former action phase found in the request map (GlobalConfiguratorImpl:447) (saved and restored by the portlet-bridge). Adding the same annotation solved this problem.
I'll provide a patch for these two classes.
A first (cumbersome) approach was to add the following to your faces-config.xml:
<faces-config>
<application>
<application-extension>
<bridge:excluded-attributes>
<bridge:excluded-attribute>org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.REQUEST_TYPE</bridge:excluded-attribute>
<bridge:excluded-attribute>org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.REQUEST_CONTEXT</bridge:excluded-attribute>
</bridge:excluded-attributes>
</application-extension>
</application>
</faces-config>
This would have forced all Trinidad / portal users to add this to faces-config.xml.
Just to put this down somewhere: there is a typo in the portlet bridge spec (a 't' missing):
<bridge:excluded-atribute>myFacesExtension.state.*</bridge:excluded-attribute>
Should be
<bridge:excluded-attribute>myFacesExtension.state.*</bridge:excluded-attribute>
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Scott O'Bryan (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12673092#action_12673092 ]
Scott O'Bryan commented on TRINIDAD-1376:
-----------------------------------------
We should move this to the dev lists, but there is always room for contribution. Why don't you open up a thread on the dev list and we'll talk about it.
I'll go ahead and commit the changes.
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Attachments: TRINIDAD-1376-patch.txt, TRINIDAD-1376.patch
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Felix Röthenbacher (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Felix Röthenbacher updated TRINIDAD-1376:
-----------------------------------------
Status: Patch Available (was: Open)
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Attachments: TRINIDAD-1376-patch.txt
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Scott O'Bryan (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12670129#action_12670129 ]
Scott O'Bryan commented on TRINIDAD-1376:
-----------------------------------------
For this issue I have created a RequestStateMap which can be used to store an object from an action to a single render. The RequestContext object is now stored on this map. I'll be uploading a patch soon which should also include a patch for TRINIDAD-1377, TRINIDAD-1383, and TRINIDAD-1351.
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Attachments: TRINIDAD-1376-patch.txt
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Scott O'Bryan (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Scott O'Bryan resolved TRINIDAD-1376.
-------------------------------------
Resolution: Fixed
Fix Version/s: 1.2.11-core
Patch applied and should be in the 1.2.11 release of Trinidad.
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Fix For: 1.2.11-core
>
> Attachments: TRINIDAD-1376-patch.txt, TRINIDAD-1376.patch
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Robert Sauer (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12672591#action_12672591 ]
Robert Sauer commented on TRINIDAD-1376:
----------------------------------------
I can additionally confirm that this patch fixes several issues I had. Basically my issues seem to be related to TRINIDAD-1376 and TRINIDAD-1383.
My example portlet currently uses {{tr:goLink}}, {{tr:commandButton}} and {{tr:commandLink}}, which basically covers our needs.
Out of curiosity: what is the "official" example for getting Trinidad with the Portlet Bridge up and running? Is there already something like this? Or is there room for a contribution?
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Attachments: TRINIDAD-1376-patch.txt, TRINIDAD-1376.patch
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1376) NullPointerException because
RequestContext released after action request.
Posted by "Scott O'Bryan (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12668994#action_12668994 ]
Scott O'Bryan commented on TRINIDAD-1376:
-----------------------------------------
Actually this issue is a little more complex if we take remote WSRP Portals into account. The Configurators were written to an earlier version of the bridge spec and I made the assumption that request scoped attributes would continue for a full lifecycle request. The EG is still considering this proposal from me, but right now this is not the case.
What I basically need to do is create a state-map which uses the session to jump from action-request to render request. I have a prototype of this in my portlet branch and I'll backport a cleaner version to the Trinidad trunk hopefully today.
> NullPointerException because RequestContext released after action request.
> --------------------------------------------------------------------------
>
> Key: TRINIDAD-1376
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1376
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Portlet
> Affects Versions: 1.2.11-core
> Reporter: Felix Röthenbacher
> Assignee: Scott O'Bryan
> Attachments: TRINIDAD-1376-patch.txt
>
>
> RequestContext is released after action request which results in a NullPointerException in the following render request.
> The problem is in the method GlobalConfiguratorImpl.endRequest(final ExternalContext externalContext)
> Calling _releaseRequestContext(externalContext); removes the RequestContext from ThreadLocal.
> Any subsequent calls to RequestContext.getCurrentInstance() return null which breaks the render request.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.