Hello,

I have a java web application by Tomcat 9 servlet container which tries to
read a file in /tmp folder with 777 permission on Ubuntu 18.04

ls -ltr /tmp/test.txt
-rwxrwxrwx 1 vagrant vagrant 10 Jan  3 17:03 /tmp/test.txt

The java code is:

    try {
        result = FileUtils.readFileToString(new File("/tmp/test.txt"));
    } catch (IOException ex) {
        log.info("##### Cannot read file. Reason: " + ex.getMessage());
    }

But it always show the error

##### Cannot read file. Reason: File '/tmp/test.txt' does not exist

This test file can be opened fine by a normal user on a terminal window
(example user: vagrant).

vagrant@ras:~$ cat /tmp/test.txt
asdasdsad

Does anybody know about the problem with Tomcat 9? I'll need the java web
application to read this test file as string.

Thanks,



--
Sent from: http://tomcat.10.x6.nabble.com/Tomcat-User-f1968778.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to