2 Replies Latest reply on May 3, 2009 1:51 PM by Frank Bitzer

    Upload (very) large files

    Frank Bitzer Newbie

      Hi there,

      I have a problem concerning the upload of large files using rich:fileupload control.

      In my application, a user can transfer quite large files (about 1-2 GB) to the server. For this purpose, I use a rich:fileupload in Flash mode (mainly because the progressbar is just awesome :)

      Furthermore, I think it's important to notice that I use Seam.

      In my session-scoped backing bean I have a listener method bound to the fileUploadListener attribute of rich:fileupload.

      Everything works very well for small files, but as soon as the time needed for uploading the file exceeds the session timeout, I get the following exception as soon as the upload has completed:

      30.04.2009 17:11:25 com.sun.faces.lifecycle.LifecycleImpl phase
      WARNUNG: executePhase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@4f5b6d) threw exception
      java.lang.NullPointerException
       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:191)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:365)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
       at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
       at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
       at java.lang.Thread.run(Thread.java:619)
      30.04.2009 17:11:25 com.sun.faces.lifecycle.LifecycleImpl phase
      WARNUNG: executePhase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@1670b57) threw exception
      java.lang.NullPointerException
       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:191)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
       at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
       at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
       at java.lang.Thread.run(Thread.java:619)
      
      


      I think the reason for this exception is that the user's session has timed out when the listener method in the backing bean is invoked after the upload has completed.

      So I wonder if there is any way to keep the session alive while the file upload is in progress (which can be, in my case, some hours)? Maybe anybody can help?

      Thanks in advance,
      Frank