Hi, The stack trace is short with FileNotFoundException
##### Cannot read file. Reason: File '/tmp/test.txt' does not exist java.io.FileNotFoundException: File '/tmp/test.txt' does not exist at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:254) at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1641) at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1659) On Sat, 4 Jan 2020 at 15:38, M. Manna <manme...@gmail.com> wrote: > Hi, > > On Sat, 4 Jan 2020 at 14:36, bphamhuu <a09...@gmail.com> wrote: > > > 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, > > > > > > What is the full stack trace? > > > > > -- > > 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 > > > > > -- *Bang Pham Huu * *-------------------------------------------------------------------------------------* *Master of Science - Research Assistant at Field Monitoring Center - 4 F, E3 BuildingViet Nam - Ha Noi National University - University of Engineering and Technology* *Email: a09...@gmail.com <a09...@gmail.com> - Tel: +84 164.6339.217* *“Life is like riding a bicycle. To keep your balance, you must keep moving.”― Albert Einstein*