0

Im using rich:fileUpload:

<rich:fileUpload id="upload" addLabel="Add File"
      clearAllLabel="Delete Files" deleteLabel="Remove" 
      uploadLabel="Process Fle" doneLabel="Processed file" 
      clearLabel="Close" listHeight="100" 
      maxFilesQuantity="1" fileUploadListener="#{mbean.listener}" > 
      <a4j:ajax event="uploadcomplete" execute="@none" render="panelResult"  />
</rich:fileUpload>

The java code in mbean.listener is running OK, but when the process is finish, the following error is showed:

09:03:49,385 ERROR [br.com.enterprise.enterprisex.faces.common.EnterpriseExceptionHandler] EnterpriseExceptionHandler.handle: 
javax.faces.application.ViewExpiredException: /1_ProcessForm.jsfNo saved view state could be found for the view identifier: /1_ProcessForm.jsf
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
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:127)
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:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

mbean.listener:

    public void listener(FileUploadEvent event) throws Exception {
    UploadedFile item = event.getUploadedFile();
    LOGGER.debug("upload listener: fileName=" + item.getName());        
}

This error occurs only in this component of richfaces. Is necessary to do some additional configuration?

Thanks.

vctlzac
  • 837
  • 2
  • 16
  • 38

1 Answers1

0

Do you recognize that path /1_ProcessForm.jsf? The context is choking on this bit most likely because that path doesn't exist. Does that path exactly correspond to the view id of the page on which you're doing the file upload (including the leading slash, '/')

EDIT : Apparently a bug with RF 4.0 might be to blame for this. Let's know how you get on with this issue

kolossus
  • 20,559
  • 3
  • 52
  • 104
  • The path is ok. When the configuration javax.faces.STATE_SAVING_METHOD is "server" this component running OK, but I need that be "client" because other reasons: http://stackoverflow.com/questions/12370904/jsf-2-0-richfaces-viewexpiredexception – vctlzac Sep 21 '12 at 11:17
  • this appears to be a [bug](https://community.jboss.org/message/619183) with RF. Sorry. Editing the answer to reflect the research – kolossus Sep 21 '12 at 16:30
  • Thanks for your answer. I see it: https://community.jboss.org/thread/164999 and then I change my mbean from ViewScoped to SessionScoped and problem solved, but I believe that is not the ideal solution because this mbean should be viewScoped. – vctlzac Sep 21 '12 at 18:40
  • It definitely is far from ideal. If you already have a `@SessionScoped` bean (to represent a generic user session for example), you can store the artifacts relevant to your operation in there and use an `@RequestScoped` bean for the page. Saves you some heap space and possibly abuse of the SessionScope in the long run – kolossus Sep 21 '12 at 18:45