Kill Tomcat on Mac

How To Kill Tomcat on Mac when IntelliJ IDEA or Eclipse has crashed or you forgot to stop Tomcat before closing Eclipse.

Step 1: find which java process is Tomcat

  • Start Activity Monitor (Applications > Utilities), then order list by Process name
  • Scroll to find java processes
  • Note the PID #’s (process ID’s)

Step 2: Pause java processes while checking Tomcat address

  • From a browser load your normal Tomcat address, e.g. http://localhost:8080/
  • You should get some sort of response, perhaps a Whitelabel Error page if using Spring
  • repeat below until Tomcat stops responding:
    • pause java PID using: kill -STOP <PID>
      • replace <PID> with the actual process ID # you found from Activity Monitor
      • example: kill -STOP 25532
    • reload Tomcat web address
    • if web page no longer responds (just continues to load), you’ve found Tomcat
      • otherwise (wasn’t Tomcat), unpause process: kill -CONT <PID>
      • example: kill -CONT 25532
    • move to next process ID number in Activity Monitor with name “java” and repeat steps

Step 3: Kill Tomcat on Mac

  • kill the Tomcat java process in Terminal using command: kill -9 <PID>
    • example: kill -9 25532
  • Check: Reload Tomcat webpage in browser.  Should show “This webpage is not available”

Activity Monitor - find java processes

Pause / Continue java process in Terminal

Tomcat page when process is paused


Posted

in

by

Tags: