Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start
Solution 1
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!
Solution 2
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
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
Solution 3
Another easy way of solving this error is right clicking in the console and click on Terminate/Disconnect All. Afterwards run the application it should work fine.
Solution 4
Issue: It's because either you are not stopping your application or the application is already somehow running on the same port somehow.
Solution, Before starting it another time, the earlier application needs to be killed and the port needs to be freed up.
Depending on your platform you can run the below commands to stop the application,
on windows
netstat -anp | find "your application port number"` --> find PID
taskkill /F /PID
on Linux,
netstat -ntpl | grep "your application port number"
kill pid // pid you will get from previous command
on Mac OS
lsof -n -iTCP:"port number"
kill pid //pid you will get from previous command
Solution 5
Find the process and terminate it. On Windows do a Control+Alt+Delete and then find the "Java(TM) Platform SE Binary" process under the Processes Tab. For example:
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
Related videos on Youtube
Sandoval0992
Updated on October 14, 2021Comments
-
Sandoval0992 over 2 years
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 undersrc/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.-
Andy Wilkinson about 7 yearsAre you stopping the application before you try to start it the second time? If so, how are you doing that? It sounds like the first instance of the application is still running.
-
Sandoval0992 about 7 yearsNo, I'm not. I actually thought the framework would perform this operations behind the scenes.
-
codingbash about 7 yearsFor a temporary workaround, you can set the port to
server.port=0
which will find a random open port to use. Although I suggest you find out a way to stop your application properly. -
Sandoval0992 about 7 yearsIt's working fine applying the solution you gave me. Thank you for finding the time to ask this question.
-
Bandham Manikanta about 6 yearsHi @codingbash, Lyk yu mentioned, i made my port number as 0 in the properties file. Still, I'm getting the same error. "The Tomcat connector configured to listen on port 0 failed to start. The port may already be in use or the connector may be misconfigured. " any guess on my issue??
-
-
Sandoval0992 about 7 yearsI've tried those commands before however, the real problem is that the application doesn't run in the same port twice.
-
Amit about 7 years@Sandoval0992 As i said, its because before restarting, you are not stopping the application.
-
want2learn almost 7 years@100Pixels I am having same trouble now. How did you fix this problem ?
-
Sandoval0992 almost 7 years@want2learn I've just marked the accepted answer, this is what I did. Just stop your boot application before trying to run it again. Click the "stop" button from the "servers" perspective. It's on the top right corner of this window.
-
Philip Rego over 6 yearsIn Cygwin $ netstat -anp | find "8080" find: ‘8080’: No such file or directory $ netstat -ntpl | grep "8080" Displays protocol statistics... (showing help). In CMD: netstat -anp returns empty
-
Philip Rego over 6 yearsThis answer has the correct commands. stackoverflow.com/a/47235112/1308453
-
Philip Rego over 6 yearsIf eclipse isn't the one using the port find which one is and kill it. stackoverflow.com/a/47235112/1308453
-
cryptonkid over 6 yearsThis issue arises because of other service or tomcat using the port already running. NOTE: STS runs tomcat from its own end and if tomcat is pre running then you need to stop the service. As mentioned in other posts you need to stop the service. The solution mentioned above talks about stopping the server if it has pre-run using STS only.
-
Bandham Manikanta about 6 yearsStill it is not working for any other ports as well.. Please help.
-
Gene about 6 yearsSorry, you're question is too ambiguous. Maybe post it as a new question and include your more background situational information. Like your OS, Error messages, etc.
-
Dhaval Shah almost 6 yearsJust try to close your IDE and run your application again.
-
arun_kk about 5 yearsThis worked for me. Thanks a lot. But not sure why even after killing the server from IntelliJ, it is not killing the process. This is happening always for me
-
VigSank almost 5 yearsThank you. I had wrong values here. :( Correcting it worked :)
-
Amidude over 4 yearsThis worked for me as well. However, it must be said that even after restarting the server once I completed this task I still got the same error but my application ran.
-
Matej J over 3 yearsOr just click blue icon in left side of screen and solve the problem withouth stopping the application. Its easy
-
Mohd Qasim over 2 yearsfor windows try
netstat -ano -p tcp |find "9443"
-
Sovichea Cheth over 2 yearsWorks for me on Windows, but need to know which process to kill if you're running multiple services.
-
Jose Flavio Quispe Irrazábal over 2 yearsSame here. I left the alias-password empty