ICEfaces
  1. ICEfaces
  2. ICE-10432

WindowScopeManager cannot get a scope when used as a plain webapp

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: EE-4.0.0.GA, 4.1
    • Component/s: ICECORE-Components
    • Labels:
      None
    • Environment:
      all
    • Assignee Priority:
      P2

      Description

      WindowScopeManager cannot create a scope when it used as a dependency inside of a webapp, and that webapp runs along side the Liferay Portal. The showcase (webapp) errors/warning as follows:
      WARNING: JSF1086: Custom scope '#{window}' evaluated to null. Unable to determine if managed bean exists.
      Dec 19, 2014 10:30:45 PM com.sun.faces.mgbean.BeanManager$ScopeManager$CustomScopeHandler handle
      WARNING: JSF1085: Custom scope '#{window}' evaluated to null. Managed bean was not pushed to scope.
      Dec 19, 2014 10:30:45 PM org.icefaces.impl.event.BridgeSetup getBodyResources
      WARNING: Unable to find WindowScope for view /showcase.xhtml

        Activity

        Hide
        Vernon Singleton added a comment - - edited

        Steps to reproduce:

        1. Download a showcase war
        2. Deploy the war in the webapp folder of a running Liferay tomcat bundle.
        3. Navigate to the localhost/showcase url

        Expected results: The showcase should render.
        Actual results: The showcase does not render, and the following errors/warnings appear in catalina.out:

        WARNING: JSF1086: Custom scope '#{window}' evaluated to null.  Unable to determine if managed bean exists.
        Dec 19, 2014 10:30:45 PM com.sun.faces.mgbean.BeanManager$ScopeManager$CustomScopeHandler handle
        WARNING: JSF1085: Custom scope '#{window}' evaluated to null.  Managed bean was not pushed to scope.
        Dec 19, 2014 10:30:45 PM org.icefaces.impl.event.BridgeSetup getBodyResources
        WARNING: Unable to find WindowScope for view /showcase.xhtml
        Show
        Vernon Singleton added a comment - - edited Steps to reproduce: 1. Download a showcase war 2. Deploy the war in the webapp folder of a running Liferay tomcat bundle . 3. Navigate to the localhost/showcase url Expected results: The showcase should render. Actual results: The showcase does not render, and the following errors/warnings appear in catalina.out: WARNING: JSF1086: Custom scope '#{window}' evaluated to null . Unable to determine if managed bean exists. Dec 19, 2014 10:30:45 PM com.sun.faces.mgbean.BeanManager$ScopeManager$CustomScopeHandler handle WARNING: JSF1085: Custom scope '#{window}' evaluated to null . Managed bean was not pushed to scope. Dec 19, 2014 10:30:45 PM org.icefaces.impl.event.BridgeSetup getBodyResources WARNING: Unable to find WindowScope for view /showcase.xhtml
        Hide
        Vernon Singleton added a comment - - edited

        This issue can be fixed at this block of code inside of the the WindowScopeManager:

        private LiferayOriginalRequestWindowScopeSharing() throws ClassNotFoundException, NoSuchMethodException {
             PortalUtilClass = Class.forName("com.liferay.portal.util.PortalUtil");
             GetHttpServletRequest = PortalUtilClass.getDeclaredMethod("getHttpServletRequest", javax.portlet.PortletRequest.class);
             GetOriginalServletRequest = PortalUtilClass.getDeclaredMethod("getOriginalServletRequest", HttpServletRequest.class);
        }

        Instead of assuming the the icefaces core jar is being used by a portlet with the Class.forName method used above, a different method could be used to determine if the icefaces core is being used by a webapp or a portlet (Maybe check the application for the existence of a portlet.xml resource). And if no portlet.xml is found, for example, then you could throw an exception.

        Show
        Vernon Singleton added a comment - - edited This issue can be fixed at this block of code inside of the the WindowScopeManager: private LiferayOriginalRequestWindowScopeSharing() throws ClassNotFoundException, NoSuchMethodException { PortalUtilClass = Class .forName( "com.liferay.portal.util.PortalUtil" ); GetHttpServletRequest = PortalUtilClass.getDeclaredMethod( "getHttpServletRequest" , javax.portlet.PortletRequest.class); GetOriginalServletRequest = PortalUtilClass.getDeclaredMethod( "getOriginalServletRequest" , HttpServletRequest.class); } Instead of assuming the the icefaces core jar is being used by a portlet with the Class.forName method used above, a different method could be used to determine if the icefaces core is being used by a webapp or a portlet (Maybe check the application for the existence of a portlet.xml resource). And if no portlet.xml is found, for example, then you could throw an exception.
        Hide
        Mircea Toma added a comment -

        Applied recommended fix that verifies if we're indeed running within Liferay and not as a parallel webapp to Liferay webapp.

        Show
        Mircea Toma added a comment - Applied recommended fix that verifies if we're indeed running within Liferay and not as a parallel webapp to Liferay webapp.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Vernon Singleton
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: