java 文件不存在异常_找不到临时文件的文件异常

我正在构建Java应用程序(Spring和JSF&PrimeFaces)。我将文件上传到服务器,但是,如果在文件上传结束后立即单击“下一步”按钮,则会出现此错误:

Aug 24, 2013 8:12:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [appServlet] in context with path [/codekata] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e1s3'] with root cause

java.io.FileNotFoundException: C:\Users\Luke\AppData\Local\Temp\upload__6f71235a_140b1bdd246__8000_00000011.tmp (The system cannot find the file specified)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.(FileInputStream.java:138)

at org.apache.commons.fileupload.disk.DiskFileItem.readObject(DiskFileItem.java:709)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)

at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)

java.lang.Thread.run(Thread.java:722)

如果我等待几秒钟,一切正常。我认为上载文件需要时间才能将其自身复制到临时文件夹中,是否有人知道如何解决此问题。我使用Tomcat 7。

这是我的下载方法:

public StreamedContent getDownloadFile()

{

InputStream inputStream = new ByteArrayInputStream(selectedBook.getBookText().getText().getBytes());

return new DefaultStreamedContent(inputStream, "text/plain", selectedBook.getTitle() + ".txt", BookBean.encoding);

}

谢谢,卢克。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值