Spring Boot: The Tomcat connector configured to listen on port 8080 failed to start

I meet with a similar issue when the webserver visit is busy, 
so your server socket may have TIME_WAIT state, 
in this case, 
the tomcat-embedded-server in spring boot can't bind this port because 
SO_REUSEADDR is not set to true

there is a similar issue for that- 
  • Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start

  • Protocol handler start failed
  • Spring Boot Issue while Running the Spring Boot APP


Solutions:-  there are multiple solutions, 
so getting to know what exactly your issue is not so easy,
here is more than one solution, 
Hit and try which one works for you.

1-

so my solution is to use Jetty in spring boot, you can change your pom.xml


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
 <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

  if the above one not working, try from below solution

2-
goto task manager -> processes and end Java(TM) Platform SE binary
processes (this will stop tomcat) and run your spring boot application 
again.
3-
On the console, looking at the topmost right side of the dialog you 
should see a red button kinda like a buzzer. To stop the spring boot 
application properly you just ran, go ahead and hit this particular 
"red" button and your problem is solved. Hope this helps!

here is some more solution-
4-
  1. Find the process ID (PID) for the port (e.g.: 8080)

    On Windows:

    netstat -ao | find "8080"

    Other Platforms other than windows :

    lsof -i:8080
  2. Kill the process ID you found (e.g.: 20712)

    On Windows:

    Taskkill /PID  20712 /F

    Other Platforms other than windows :

    kill -9 20712   or kill 20712

5-
Another easy way of solving this error is right-clicking in the console and click on Terminate/Disconnect All. Afterward, run the application it should work fine.

6-

On Ubuntu, you can use "ps aux | grep java" 

to find the process and "kill -9 PID_NUMBER" to kill the process.

OR

If you're using a Spring boot application, go to application.properties and add this:

server.port = 8081

7-
 In case your app is run on https, 
make sure you put right values
under the following properties:
server.ssl.key-store-password=
server.ssl.key-alias=

No comments:

Post a Comment