6 Replies Latest reply on Jan 20, 2011 5:56 AM by Oliver G.

    fileUpload with JSF 2 and RF 3.3.3

    Oliver G. Newbie



      we were using the rich:fileUpload component together with JSF 1.2 and it worked perfect. Now we tried to upgrade to JSF 2 and most RF components are still working nice.


      But now rich:fileUpload seem to have problems with uploads greater than ca. 3 MB (not easy to reproduce on local testing, occurs if you are accessing via limited (upload-) bandwith like some hundreds KB/s). This exception occurs when the upload status bar is complete:



      ... ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[Faces Servlet].invoke:274] Servlet.service() for servlet Faces Servlet threw exception

      javax.faces.application.ViewExpiredException: .../upload.jsfNo saved view state could be found for the view identifier: .../upload.jsf

      at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128) ...


      Has anyone got similar problems or do know what can help? (Use of RF 4 not possible until not final)

      Thank you!


      Environment: Tomcat 6 on JRE 6, RF 3.3.3 Final, JSF 2, Spring 3

        • 1. fileUpload with JSF 2 and RF 3.3.3
          Oliver G. Newbie

          BTW: web.xml settings are okay. We prooved that this is not a problem of limited session timeout or limited upload size.

          • 2. fileUpload with JSF 2 and RF 3.3.3
            Ilya Sorokoumov Master

            javax.faces.application.ViewExpiredException means that a user's session has expired. You can try to increase time of the session for your application.

            The following strings should do the trick:




            Or you can try HttpSession setMaxInactiveInterval as an alternative.

            • 3. fileUpload with JSF 2 and RF 3.3.3
              Oliver G. Newbie

              As I mentioned above, the session-timeout has a high value in web.xml and the upload of some MB fails after 2 or 3 minutes (after login).


              BTW: The handling bean has request scope and KeepAlive-Annotation

              • 4. fileUpload with JSF 2 and RF 3.3.3
                Ilya Sorokoumov Master

                Hm. If you are using KeepAlive-Annotation this question will be answered better by RF team.

                • 6. Re: fileUpload with JSF 2 and RF 3.3.3
                  Oliver G. Newbie

                  We found a little trade-off: we set allowFlash="auto". Then big file uploads work for guys who have Flash in their browser (but not if they have no Flash). In our case, we cannot be sure if all customers have Flash-Plugin, but the probabillity is high, i think.


                  Previous code:



                  <rich:fileUpload id="fileUpload" locale="#{sessionBean.language}" maxFilesQuantity="#{bean.uploadsAvailable}"

                            allowFlash="false" status="waitStatus" fileUploadListener="#{bean.listener}" ajaxSingle="true"

                            doneLabel="#{labels.rich_fileUpload_done}" listHeight="65px" immediateUpload="true"

                            transferErrorLabel="#{bean.transferError}" transferErrorLabelClass="fileUploadTransferError"

                            sizeErrorLabel="#{messages.bean_file_maxsize}" sizeErrorLabelClass="fileUploadTransferError"


                            <a4j:support event="onclear" reRender="fileUpload,uploadPanelSelect" action="#{bean.clear}" ajaxSingle="true" />

                            <a4j:support event="onfileuploadcomplete" reRender="uploadPanelSelect" limitToList="true" />

                            <a4j:support event="ontyperejected" reRender="uploadForm" action="#{bean.onTypeRejected}" ajaxSingle="true" />

                            <f:facet name="label">


                                value="{_MB} MB #{labels.rich_fileUpload_from} {MB} MB #{labels.rich_fileUpload_uploaded} ({mm}:{ss})" />







                    public void listener(final UploadEvent event) {

                      if (event.getUploadItem() == null) return;







                  Some web.xml settings:








                      <display-name>Ajax4jsf Filter</display-name>



















                      <servlet-name>Faces Servlet</servlet-name>