简体   繁体   中英

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?

Tomcat was missing a temp directory.

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

我自己发现了问题:tomcat中缺少临时目录。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM