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

        Neil Griffin created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Assignee Mircea Toma [ mircea.toma ]
        Fix Version/s 4.1.1 [ 12972 ]
        Assignee Priority P1 [ 10010 ]
        Neil Griffin made changes -
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: