Category Archives: Tomcat

Window : How to Kill/Stop tomcat service from command line?

Generally, when run tomcat by eclipse or use embedded tomcat with spring and suddenly close eclipse. But in background tomcat is running. When you try to run tomcat again you will face below exception:

[Solved] Tomcat : Address already in use: bind


There are two ways to kill tomcat process:

  • Manually kill tomcat process from command line
  • Create script to kill tomcat processes

Manually  kill Tomcat Process from Command line

  1. Go to (Open) Command Prompt (Press Window + R then type cmd Run this).
  2. Run following commands to get all listening ports (If tomcat runnig on other ports apart from 8080)

netstat -aon | find /i "listening"

Apply port filter If you know port number

netstat -aon |find /i "listening" |find "8080"

As in below screen you will get PID and then  run the following command to kill the process

3 Copy PID from result set

taskkill /F /PID

Ex: taskkill /F /PID 13332

Kill Tomcat process from command line

Steps to kill Tomcat Process by script

  • Step 1: Copy below script in note pad and save it with extension as .bat

netstat -aon |find /i "listening"

SET /P killPORT=Enter port: 
IF "%killPORT%"=="" GOTO Kill

netstat -aon |find /i "listening" | find "%killPORT%"

SET killPID=
SET /P killPID=Enter PID to kill: 
IF "%killPID%"=="" GOTO Error

ECHO Killing %killPID%!
taskkill /F /PID %killPID%

ECHO No Process to kill!

  • Steps 2: Click  on saved batch file you will get list of all running processes on ports.
  • Step 3: Enter port which you want to kill. Script will return PID for same .
  • Step 4: Enter PID which you want to kill then your tomcat will stop.

Kill Tomcat process by script

[Solved] Tomcat : Address already in use: bind

This is exception occurs when using port for tomcat server is already used and not closed yet.

Sometimes when eclipse hang and you directly close eclipse by task manager then eclipse close but tomcat process still running. When you open Eclipse again and try to run tomcat to deploy application. On that time you will get below exception as “ Address already in use“.


org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8080]]
	at org.apache.catalina.util.LifecycleBase.start( ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.StandardService.addConnector( ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at [spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at org.springframework.boot.SpringApplication.refresh( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext( [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
	at com.fiot.controller.Example.main( [classes/:na]
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
	at org.apache.catalina.connector.Connector.startInternal( ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.util.LifecycleBase.start( ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	... 13 common frames omitted
Caused by: Address already in use: bind
	at Method) ~[na:1.8.0_151]
	at Source) ~[na:1.8.0_151]
	at Source) ~[na:1.8.0_151]
	at Source) ~[na:1.8.0_151]
	at Source) ~[na:1.8.0_151]
	at ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.coyote.AbstractProtocol.start( ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.connector.Connector.startInternal( ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	... 14 common frames omitted

2018-05-28 15:36:23.875  INFO 12964 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-05-28 15:36:23.898  INFO 12964 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-05-28 15:36:23.900 ERROR 12964 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


Please follow below steps to resolve this issue.


  • Got to (Open) Command Prompt (Press Window +R) or type cmd on run.
  • Get running process for port on command prompt.

netstat -aon |find /i “listening” |find “PortNumber

  • Kill Process running for port.

taskkill /F /PID ProcessNumber