3 Replies Latest reply on Dec 16, 2005 1:52 PM by roy.russo

    Null Pointer Exception in MyFacesGenericPortlet

    stefan_tausendpfund

      Hello,

      Stan Silvert asked me to also post the message from myfaces user forum here:
      http://www.mail-archive.com/users%40myfaces.apache.org/msg13439.html


      ---
      Hello,


      we created an portal application on JBoss Server 4.0.3SP1 with portal 2.0.1RC3 using myfaces MyFacesGenericPortlet. We have several pages and several portlets in one page. One portlet is present in all pages. If I make an action on this portlet (portletwindow0) and switch the page (portletwindow1) i get an NPE in the facesRender method of the MyFacesGenericPortlet.

      The lookup of the faces context with

      ServletFacesContextImpl facesContext = (ServletFacesContextImpl)request.

      getPortletSession().

      getAttribute(CURRENT_FACES_CONTEXT);

      returns a null object and the following statement
      if (facesContext.getResponseComplete()) return;
      fails.
      On first entry of doView the getAttribure looks for an Attribute:
      javax.portlet.p.<instance>.<portletwindow0>?org.apache.myfaces.portlet.MyFacesGenericPortlet.CURRENT_FACES_CONTEXT

      After switching the page it looks for
      javax.portlet.p.<instance>.<portletwindow1>?org.apache.myfaces.portlet.MyFacesGenericPortlet.CURRENT_FACES_CONTEXT

      but the facescontext is still with the key window0 in the session.


      Using the same window name in different pages for the same portlet leeds to a portal error.

      Can you please help me here?

      Thanks in advance
      Stefan

      ----


      I also made a small sample application showing this bug. Can i place it as attachment here?

      regards
      Stefan