1
votes

I have created a single web page application using Spring boot and i have configured the port number in application.properties file. server.port=9991 When I right click my project and click as Spring Boot App it runs fine and when i run it for the second time its throwing that port is already in use.

I am using Spring Tool Suite.

Please let me know why I am getting error.

Error Message:

Description:

The Tomcat connector configured to listen on port 9991 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 9991, or configure this application to listen on another port.

3

3 Answers

1
votes

The first application you started was probably still running when you started oh the second time. Kill the process manually. Look for java processes and kill them.

0
votes

If I am not mistaken, you can just configure port 0 for your application to let the OS pick a port for you. So you could have multiple instances running on the same box at the same time. Porbably you will encounter more conflicting ports for management etcetera.

0
votes

I think you are using eclipse IDE. when you run first time your program it will take your current port number. I think you are running your application without stop your old process. simply way in eclipse, there is your application running log. there is cross btn or red square btn click that btn and re run that.