
In this example, we’ve increased it from 1024 to 2048. # vi /etc/security/nfĪfter you made that change, exit out of your current shell, and login again, you’ll see the new value for the open files. This will change the soft and hrad limit for the “open files” values for “tomcat” user. To increase the open files limit on Linux, as root, append the following lines to your /etc/security/nf file. You can also execute ulimit -a to view all the current ulimit values as shown below: $ ulimit -a In this example, the following command is executed as user “tomcat”. To view the current hard limit and soft limit for the open files, execute the following command as the user who is running the java application.

In this case, the java application is started by the username “tomcat”. Please note that there will be a slight difference in the count between the following output and the above output, as lsof will display few additional information. # cd /proc/4003/fdĪnother way to view all the open files is using lsof command as shown below. For this, go to /proc/PID/fd directory, and count the number of files there as shown below. Next, count how many files this particular PID has opened. In the following example, 4003 is the PID. If you are pretty sure that there is nothing wrong in the application logic, and it really needs to open more files, then you can increase the ulimit of the open files as explained in this article.įirst, get the PID of the java application that is throwing this error message.

From your java application, under certain circumstances, you might be getting “java.io.FileNotFoundException: Too many open files” error message.
