2

I have TomCat deployed on a Windows server for the purpose of hosting a Java application. I just modified TomCat within the properties tab such that it will try to restart automatically if Tomcat fails. How can I test this? I want to make TomCat fail so I can see if the automatic restart works properly.

One such way is to cause it to run out of memory. But I don't know how to do that. Is there another way, or would someone be able to explain how to make Tomcat run out of memory?

Curiousity
  • 29
  • 2
  • Create a servlet that calls `System.exit(1)`. That'll kill Tomcat for sure. Or just kill the Tomcat process from the task manager (Windows) or `kill` command (Linux). – Andreas Jul 24 '18 at 20:32
  • @Andreas, is killing the Tomcat process from Taskmanager the same thing as going under the Services tab within Taskmanager, right clicking the process, and selecting "Stop"? I think the answer to my question is "no", but I don't see any "Kill" switch within task manager for any service. – Curiousity Jul 24 '18 at 20:58
  • No, because using service stop is a controlled stop, and doesn't trigger "failure restart" *(if it did you could never stop the service, right?)*. – Andreas Jul 24 '18 at 21:03
  • Right-click the process and "end" or "kill" it. – Andreas Jul 24 '18 at 21:12
  • I ended up manually killing TomCat with the "taskkill" command in the command line. It did not restart the service automatically like I configured it to within the Recovery tab. Perhaps killing it that way is not the same as making TomCat fail? – Curiousity Jul 24 '18 at 21:17

0 Answers0