user2088476
user2088476

Reputation: 613

Writing temp file in tomcat 7.0 fails

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?

Upvotes: 7

Views: 3434

Answers (2)

Amit Kaneria
Amit Kaneria

Reputation: 5808

Tomcat was missing a temp directory.

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

Upvotes: 5

user2088476
user2088476

Reputation: 613

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

Upvotes: 4

Related Questions