Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing temp file in tomcat 7.0 fails

Tags:

java

tomcat7

I try to write a temporary file from a tomcat 7.0 application. It fails:

Servlet code snippet:

  File formFile = File.createTempFile("document", ".pdf");

Exception

  java.io.IOException: No such file or directory
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.io.File.createTempFile(File.java:1879)
    at java.io.File.createTempFile(File.java:1923)
    at goGet(ServletTest.java:20)}

I guess catalina.policy is in the way. How can I enable temp files for Web Applications?

like image 543
user2088476 Avatar asked May 14 '13 16:05

user2088476


2 Answers

Tomcat was missing a temp directory.

Above issue got fixed on tomcat by creating a temp directory in tomcat base directory(cataline_home directory).

like image 136
Amit Kaneria Avatar answered Nov 03 '22 01:11

Amit Kaneria


I found the problem myself: temp directory was missing in tomcat.

like image 20
user2088476 Avatar answered Nov 03 '22 01:11

user2088476