javax.faces.FacesException:java.io.IOException:Stream在p:fileDownload中填充了primefaces

时间:2013-12-18 10:34:14

标签: primefaces download

我使用了primefaces的fileDownload组件。如果用户第一次成功下载任何文件,下次如果用户没有选择任何文件下载并尝试下载,则抛出以下错误..

15:35:23,233 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-127.0.0.1/127.0.0.1:8080-6) java.io.IOException: Stream Closed: javax.faces.FacesException: java.io.IOException: Stream Closed at org.primefaces.component.filedownload.FileDownloadActionListener.processAction(FileDownloadActionListener.java:81) [primefaces-3.5.jar:]
  at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
  at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:775) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
  at javax.faces.component.UICommand.broadcast(UICommand.java:300) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
  at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
  at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
  at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.18-jbossorg-1.jar:]
  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.18-jbossorg-1.jar:]
  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.18-jbossorg-1.jar:]
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.1.18.Final.jar:2.1.18.Final]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77) [primefaces-3.5.jar:]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final.jar:7.2.0.Final]
  at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final.jar:7.2.0.Final]
  at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
Caused by:java.io.IOException: Stream Closed at java.io.FileInputStream.readBytes(Native Method) [rt.jar:1.7.0_25] at java.io.FileInputStream.read(FileInputStream.java:220) [rt.jar:1.7.0_25]
  at org.primefaces.component.filedownload.FileDownloadActionListener.processAction(FileDownloadActionListener.java:71) [primefaces-3.5.jar:]
        ... 27 more

1 个答案:

答案 0 :(得分:0)

我在尝试找到与我的问题完全相同的解决方案时找到了您的问题,但最后我找到了解决方案,如果您想在此处查看我的答案:

Primefaces downloadFile java.io.IOException: Stream Closed after second time

我希望这会对你有所帮助。