ICEfaces
  1. ICEfaces
  2. ICE-10952

ClassCastException thrown by FileEntryUpload.afterPhase(PhaseEvent) with Servlet 3.x (Tomcat 8) and portlets

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1
    • Fix Version/s: 4.1.1
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Liferay Portal 7 / Tomcat 8
    • Assignee Priority:
      P1

      Description

      Steps to Reproduce:

      - Download and install [Liferay Portal 7.0.0-B7|http://sourceforge.net/projects/lportal/files/Liferay%20Portal/7.0.0%20B7/] (scheduled to be released this week -- B7 includes Tomcat 8 whereas B6 includes Tomcat 7)

      - Copy the icefaces4-portlet-4.0.0-SNAPSHOT.war attachment from ICE-10951 to the $LIFERAY_HOME/deploy folder

      - Add a new portal page named ICE4
          - Click on the "Menu" icon in the UPPER LEFT corner
          - Click on the "+" icon that has title "Add Page"
          - Type "ICE4" for the name and press enter/return

      - Add the ICEfaces4 portlet to a portal page
          - Click on the "+" icon in the UPPER RIGHT conrer
          - Click on "Applications" in the accordion menu
          - Click on "Sample"
          - Click the "Add" link to the right of "ICEfaces4"

      - Reload the ICE4 page

      - Attempt to upload a file and click Submit

      If the bug is fixed, then the file will upload properly.

      Otherwise, if the bug still exists, then this error message will be rendered above the portlet: "The server request has failed because there was a problem reading the multi-part request"

      In the debugger, I found that the try/catch block at line#151 of FileEntryUpload.afterPhase(PhaseEvent) was getting hit:
      {code}
                              FacesMessage ajaxResponse = FileEntryStatuses.PROBLEM_READING_MULTIPART.getFacesMessage(facesContext, (UIComponent)null, (FileInfo)null);
                              facesContext.addMessage((String)null, ajaxResponse);
                              if(facesContext.isProjectStage(ProjectStage.Development)) {
                                  log.log(Level.WARNING, "Problem reading multi-part form upload, likely due to a file upload being cut off from the client losing their network connection or closing their browser tab or window.", var30);
                              }
      And the exception in the debugger is:
      {noformat}
      java.lang.ClassCastException: com.liferay.faces.bridge.filter.liferay.internal.ResourceRequestBridgeLiferayImpl cannot be cast to javax.servlet.http.HttpServletRequest
      {noformat}

      It is my best guess that this is happening in Liferay 7 (but not Liferay 6.2) because Liferay 7 is bundled with Tomcat 8, and this section of code in FileEntryUpload.java is executing because Class.forName("javax.servlet.http.Part") returned a non-null value, indicating Servlet 3.x (Tomcat 8) instead of Servlet 2.5 (Tomcat 7).

        Activity

        Hide
        Carmen Cristurean added a comment -

        Verified ICEfaces 4.1.1 Jenkins Build #6, showcase > fileEntry demos on Tomcat8.0.21/ IE11.

        Show
        Carmen Cristurean added a comment - Verified ICEfaces 4.1.1 Jenkins Build #6, showcase > fileEntry demos on Tomcat8.0.21/ IE11.
        Hide
        Neil Griffin added a comment -

        Successfully tested on Liferay Portal 7.0-B7, Liferay Portal 6.2.5, and Pluto 2.0.2 using Liferay Faces Bridge 4.0.0-SNAPSHOT (new version scheme).

        Show
        Neil Griffin added a comment - Successfully tested on Liferay Portal 7.0-B7, Liferay Portal 6.2.5, and Pluto 2.0.2 using Liferay Faces Bridge 4.0.0-SNAPSHOT (new version scheme).
        Hide
        Mircea Toma added a comment - - edited

        The issue is caused by the refactoring in Liferay code base. com.liferay.portal.util.PortalUtil and com.liferay.portal.theme.ThemeDisplay classes that EnvUtils loos up are located at com.liferay.portal.kernel.util.PortalUtil and com.liferay.portal.kernel.theme.ThemeDisplay.

        The lookup code in org.icefaces.util.EnvUtils will now fallback into using com.liferay.portal.kernel package as root package when running in Liferay 7.*.

        Show
        Mircea Toma added a comment - - edited The issue is caused by the refactoring in Liferay code base. com.liferay.portal.util.PortalUtil and com.liferay.portal.theme.ThemeDisplay classes that EnvUtils loos up are located at com.liferay.portal.kernel.util.PortalUtil and com.liferay.portal.kernel.theme.ThemeDisplay . The lookup code in org.icefaces.util.EnvUtils will now fallback into using com.liferay.portal.kernel package as root package when running in Liferay 7.*.
        Hide
        Neil Griffin added a comment -

        Attached is an updated version of icefaces4-portlet-4.0.0-SNAPSHOT.war that contains the <multipart-config> in web.xml and the correct liferay-faces-bridge-ext.jar for Liferay 7.

        Show
        Neil Griffin added a comment - Attached is an updated version of icefaces4-portlet-4.0.0-SNAPSHOT.war that contains the <multipart-config> in web.xml and the correct liferay-faces-bridge-ext.jar for Liferay 7.
        Hide
        Mircea Toma added a comment -

        I cannot run icefaces4-portlet-4.0.0-SNAPSHOT.war on Liferay Portal 7.0.0-B7. I get this exception:

        13:11:45,699 ERROR [http-nio-8080-exec-19][render_portlet_jsp:131] null
        java.lang.NoClassDefFoundError: com/liferay/portal/theme/ThemeDisplay
        	at com.liferay.faces.bridge.context.liferay.internal.BridgePortalContextLiferayCompatImpl.isLiferayNamespacingParameters(BridgePortalContextLiferayCompatImpl.java:47)
        	at com.liferay.faces.bridge.context.liferay.internal.BridgePortalContextLiferayImpl.<init>(BridgePortalContextLiferayImpl.java:91)
        	at com.liferay.faces.bridge.filter.liferay.internal.BridgePortletRequestFactoryLiferayImpl.getRenderRequest(BridgePortletRequestFactoryLiferayImpl.java:73)
        	at com.liferay.faces.bridge.internal.BridgePhaseRenderImpl.<init>(BridgePhaseRenderImpl.java:75)
        	at com.liferay.faces.bridge.internal.BridgePhaseFactoryImpl.getBridgeRenderPhase(BridgePhaseFactoryImpl.java:54)
        	at com.liferay.faces.bridge.internal.BridgeImpl.doFacesRequest(BridgeImpl.java:129)
        	at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:263)
        	at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:359)
        	at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:212)
        	at javax.portlet.GenericPortlet.render(GenericPortlet.java:262)
        	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
        	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57)
        	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
        	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
        	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:113)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119)
        	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:115)
        
        Show
        Mircea Toma added a comment - I cannot run icefaces4-portlet-4.0.0-SNAPSHOT.war on Liferay Portal 7.0.0-B7. I get this exception: 13:11:45,699 ERROR [http-nio-8080-exec-19][render_portlet_jsp:131] null java.lang.NoClassDefFoundError: com/liferay/portal/theme/ThemeDisplay at com.liferay.faces.bridge.context.liferay.internal.BridgePortalContextLiferayCompatImpl.isLiferayNamespacingParameters(BridgePortalContextLiferayCompatImpl.java:47) at com.liferay.faces.bridge.context.liferay.internal.BridgePortalContextLiferayImpl.<init>(BridgePortalContextLiferayImpl.java:91) at com.liferay.faces.bridge.filter.liferay.internal.BridgePortletRequestFactoryLiferayImpl.getRenderRequest(BridgePortletRequestFactoryLiferayImpl.java:73) at com.liferay.faces.bridge.internal.BridgePhaseRenderImpl.<init>(BridgePhaseRenderImpl.java:75) at com.liferay.faces.bridge.internal.BridgePhaseFactoryImpl.getBridgeRenderPhase(BridgePhaseFactoryImpl.java:54) at com.liferay.faces.bridge.internal.BridgeImpl.doFacesRequest(BridgeImpl.java:129) at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:263) at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:359) at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:212) at javax.portlet.GenericPortlet.render(GenericPortlet.java:262) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103) at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:57) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:113) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:115)

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Neil Griffin
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: