0 Replies Latest reply on Oct 16, 2012 12:17 PM by Luciano Bandeira

    How to avoid FileUploadException when abort a upload by going to another page?

    Luciano Bandeira Newbie

      Hello guys,

       

      I am getting a FileUploadException when:

       

      1. Upload a big file using rich:fileUpload component.
      2. During the upload process, go to another page.

       

      I tried to surrond the call to UploadedFile.getData() with a try-catch block, but it doesn't solve the problem.

       

      Here is the stack trace:

       

      18:11:19,930 SEVERE [org.richfaces.log.Application] (http-localhost-127.0.0.1-8080-1) Exception parsing multipart request: Request data cannot be read: org.richfaces.exception.FileUploadException: Exception parsing multipart request: Request data cannot be read
                at org.richfaces.request.MultipartRequestParser.parse(MultipartRequestParser.java:156) [richfaces-components-ui-4.2.2.Final.jar:4.2.2.Final]
                at org.richfaces.request.MultipartRequest25.parseIfNecessary(MultipartRequest25.java:77) [richfaces-components-ui-4.2.2.Final.jar:4.2.2.Final]
                at org.richfaces.request.MultipartRequest25.getParameter(MultipartRequest25.java:114) [richfaces-components-ui-4.2.2.Final.jar:4.2.2.Final]
                at com.sun.faces.context.RequestParameterMap.containsKey(RequestParameterMap.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
                at java.util.Collections$UnmodifiableMap.containsKey(Unknown Source) [rt.jar:1.7.0_05]
                at org.jboss.weld.jsf.WeldPhaseListener.getConversationId(WeldPhaseListener.java:171) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:99) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
                at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
                at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
                at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
                at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) [urlrewritefilter-3.2.0.jar:3.2.0]
                at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) [urlrewritefilter-3.2.0.jar:3.2.0]
                at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) [urlrewritefilter-3.2.0.jar:3.2.0]
                at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381) [urlrewritefilter-3.2.0.jar:3.2.0]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
                at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
                at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_05]
      Caused by: java.io.IOException: Request data cannot be read
                at org.richfaces.request.MultipartRequestParser.readData(MultipartRequestParser.java:279) [richfaces-components-ui-4.2.2.Final.jar:4.2.2.Final]
                at org.richfaces.request.MultipartRequestParser.readNext(MultipartRequestParser.java:294) [richfaces-components-ui-4.2.2.Final.jar:4.2.2.Final]
                at org.richfaces.request.MultipartRequestParser.parse(MultipartRequestParser.java:151) [richfaces-components-ui-4.2.2.Final.jar:4.2.2.Final]
                ... 35 more
      

       

      Is there any way to avoid that exception? I am running Rrichfaces v.4.2.2.Final on JBoss 7.1.0.Final.