Error:
Failed to get the max Heap for Tomcat on Linux(Centos).
ERROR SystemUsage:65 - Failed to get max Heap
java.lang.NumberFormatException: For input string: "2048M".
Solution:
Follow the steps below to resolve this issue:
- Go to "Tomcat Directory"/bin directory
- Create setenv.sh.
- Content of setenv.* file :
export CATALINA_OPTS="$CATALINA_OPTS -Xms1024m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx2048m"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=1024m"
- Restart the Tomcat service.
- If you have installed Tomcat as a service on Linux, follow these steps
1. Create a set.env
file similar to the example provided.
2. Edit the Tomcat service file and modify it as follows:
Environment='CATALINA_OPTS=-Xms1024m -Xmx2048m -XX:MaxPermSize=1024M'
- Run below command:
sudo systemctl daemon-reload.
- Restart the tomcat service.