I have the option to restart tomcat on outofmemory.
-XX:OnOutOfMemoryError=/opt/tomcat/bin/restart.sh
Here is the restart.sh
#!/bin/bash
pkill -9 -f tomcat
/opt/tomcat/bin/startup.sh
Tomcat executes the script , kills the tomcat, but doesn't start it back again. Here is the log
java.lang.OutOfMemoryError: Java heap space
# -XX:OnOutOfMemoryError="/opt/tomcat/bin/restart.sh"
# Executing /bin/sh -c "/opt/tomcat/bin/restart.sh"...
Please help me debug why tomcat doesn't restart.
I did'nt find an answer for this question, but I ended up running a health check on tomcat every 2 minutes which solved my problem of manually restarting tomcat whenever it is out of memory.