javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-1915

StateContext fails in Portlet environment because of stale/cached FacesContext reference

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.1.12, 2.2.0-m05
    • Component/s: None
    • Labels:
      None
    • Status Whiteboard:
      Hide

      size_small importance_medium

      Show
      size_small importance_medium

      Description

      It appears that the com.sun.faces.context.StateContext in 2.0.3 has an AddRemoveListener class that caches the FacesContext in a member variable. In the Portlet environment the Faces Lifecycle is run across two portlet request each which establish and remove a FacesContext. Unfortunately this listener seems to be held/cached/reused across these two requests causing an exception to be thrown when it dereferences the FacesContext (in its member variable) which was released at the end of action processing.

      Simple fix is to not store the FacesContext is a member variable but to always get/access it via FacesContext.getCurrentInstance(). Alternatively steps could be taken to release this listener when the FacesContext is released.

        Activity

        Hide
        rogerk added a comment -

        triage

        Show
        rogerk added a comment - triage
        Hide
        rogerk added a comment -

        Thanks Mike -

        I'll take a look at this as soon as our workspace is tagged (hopefully tomorrow)..

        -roger

        Show
        rogerk added a comment - Thanks Mike - I'll take a look at this as soon as our workspace is tagged (hopefully tomorrow).. -roger
        Hide
        Patrick Dobler added a comment -

        The very same cache mechanism can be found here: com.sun.faces.component.CompositeComponentStackManager

        ...which makes it impossible to handle full page posts in JSF 2.0 portlets (in order to render other portlets on the same page) where the CompositeComponentStackManager is taken into account!

        Show
        Patrick Dobler added a comment - The very same cache mechanism can be found here: com.sun.faces.component.CompositeComponentStackManager ...which makes it impossible to handle full page posts in JSF 2.0 portlets (in order to render other portlets on the same page) where the CompositeComponentStackManager is taken into account!
        Hide
        Patrick Dobler added a comment -

        Please note that the following Class has the same cache mechanism as well!

        com.sun.faces.el.CompositeComponentAttributesELResolver.ExpressionEvalMap

        Show
        Patrick Dobler added a comment - Please note that the following Class has the same cache mechanism as well! com.sun.faces.el.CompositeComponentAttributesELResolver.ExpressionEvalMap
        Hide
        rogerk added a comment -

        Can you take a look at 2.0.4 and see if that works for you?

        Show
        rogerk added a comment - Can you take a look at 2.0.4 and see if that works for you?
        Hide
        rogerk added a comment -

        2.0.6 (and soon to be 2.0.7) is the latest - so you can even try that.

        Show
        rogerk added a comment - 2.0.6 (and soon to be 2.0.7) is the latest - so you can even try that.
        Hide
        rogerk added a comment -

        It does look like CompositeComponentStackManager still needs some cleanup w/r/t FacesContext caching.

        Show
        rogerk added a comment - It does look like CompositeComponentStackManager still needs some cleanup w/r/t FacesContext caching.
        Hide
        Manfred Riem added a comment -

        StateContext does not contain any hard references to FacesContext anymore.

        Show
        Manfred Riem added a comment - StateContext does not contain any hard references to FacesContext anymore.

          People

          • Assignee:
            Unassigned
            Reporter:
            mfreedma
          • Votes:
            8 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: