I am creating a java application (Spring and JSF and PrimeFaces). I upload the file to the server, however, if I click the "next" button right after the file upload is complete, I will get this error:
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.<init>(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)
If I wait a couple of seconds, everything will be fine. I assume that the boot file should have time to copy itself to a temporary folder, does anyone have an idea how to solve this problem. I am using Tomcat 7.
Here is my download method:
public StreamedContent getDownloadFile() { InputStream inputStream = new ByteArrayInputStream(selectedBook.getBookText().getText().getBytes()); return new DefaultStreamedContent(inputStream, "text/plain", selectedBook.getTitle() + ".txt", BookBean.encoding); }
Thanks, Luke.
source share