ERROR 4928 BindException Address already in use

The Spring boot application uses tomcat as a web server. The default tomcat port is 8080. If any application listens to port 8080 and if you start the spring boot application, this exception is thrown as tomcat can not use port 8080.


ERROR 4928 --- [           main] org.apache.catalina.util.LifecycleBase   : Failed to start component [Connector[HTTP/1.1-8080]]
 org.apache.catalina.LifecycleException: Protocol handler start failed
     at org.apache.catalina.connector.Connector.startInternal( ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at org.apache.catalina.util.LifecycleBase.start( ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at org.apache.catalina.core.StandardService.addConnector( [tomcat-embed-core-9.0.24.jar:9.0.24]
     at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at org.springframework.boot.SpringApplication.refresh( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at org.springframework.boot.SpringApplication.refreshContext( [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
     at com.yawintutor.SpringHelloWorldJspApplication.main( [classes/:na]
 Caused by: Address already in use: bind
     at java.base/ Method) ~[na:na]
     at java.base/ Source) ~[na:na]
     at java.base/ Source) ~[na:na]
     at java.base/ Source) ~[na:na]
     at java.base/ Source) ~[na:na]
     at ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at org.apache.coyote.AbstractProtocol.start( ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     at org.apache.catalina.connector.Connector.startInternal( ~[tomcat-embed-core-9.0.24.jar:9.0.24]
     … 14 common frames omitted

Root Cause

Tomcat is running on port 8080. Spring boot application uses tomcat as the default web server. The port 8080 is currently being used by the application and tomcat is trying to listen to port 8080.

Solution 1

You’ve already started and running the spring boot application. Now you’re trying to run the spring boot application again. Stop all the instance or restart your IDE.

Solution 2

Some external applications already use port 8080. Check the running application in the task manager, stop the application that listen to port 8080

Run the command below in linux to find the application that uses port 8080, and then kill the process if you want to stop.

ps -ef | grep 8080

kill -9 <process id>

Solution 3

Change the default listening port in and start the spring boot application again


How to create simple Spring Boot Application with Main method

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *