Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start

I'm developing a REST API using Spring Framework.

First I wasn't able to run my application because of the same problem. The port 8080 on my computer is busy. Then I found out that one alternative to solve this problem is creating an application.properties file under src/main/resources folder. That's what I made, and set up the server to listen on port 8090. This worked but only for the first time, now I'm getting the same exception whenever I try to run the application for the second time.

Description:  The Tomcat connector configured to listen on port 8090 failed to start. The port may already be in use or the connector may be misconfigured.  Action:  Verify the connector's configuration, identify and stop any process that's listening on port 8090, or configure this application to listen on another port. 

As far as I know, this framework makes use of an embedded instance of apache tomcat to deploy every application.

My guess is, the server is not getting restarted the second time I try to run the app, that's why the output says " The port may already be in use or the connector may be misconfigured"

So, a more specific question would be, how can I manage the embedded instance of apache tomcat either manually or programmatically?

I've also modified the port in the application.properties file twice. It works fine, but again, only for the first time. As you can imagine I cannot do the same each time the app is going to be executed.

like image 800
Sandoval0992 Avatar asked Mar 26 '17 07:03

Sandoval0992


2 Answers

  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 
like image 190
sy456 Avatar answered Sep 20 '22 15:09

sy456


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!

like image 22
Edge Avatar answered Sep 16 '22 15:09

Edge