java.net.SocketException: Too many open files

For System Wide settings
To see the settings for maximum open files for the OS level, use following command.
cat /proc/sys/fs/file-max
This should be a value from 36000 to 50000 or more. To increase the system wide maximum open files, as root edit the /etc/sysctl.conf and add the following to the end of the file.

Note: The following example will increase the maximum number of files to 49,500 on your currently running system and will persist after rebooting.

fs.file-max = 49500

Then issue the following command to activate this change to your live system.
sysctl -p

For user level setting

Also, you should update /etc/security/limits.conf for the user.

myuser hard nofile 2048
myuser soft nofile 2048

Type this to see what it’s set at:

ulimit -a

One Reply to “java.net.SocketException: Too many open files”

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.