I am developing a REST API using the Spring Framework
At first, I could not start my application due to the same problem. Port 8080 on my computer is busy. Then I discovered that one of the alternatives to solve this problem is to create an application.properties file in the src/main/resources folder. This is what I did and configured the server to listen on port 8090. This worked, but only for the first time, now I get the same exception when I try to run the application a 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 configuration, identify and stop any process that listening on port 8090, or configure this application to listen on another port.
As far as I know, this environment uses a built-in instance of Apache Tomcat to deploy each application.
I assume that the server does not restart the second time when I try to start the application, so the output says: "The port may be already in use or the connector is configured incorrectly"
So, more specific questions may be, how can I manage the embedded apache tomcat instance manually or programmatically?
I also changed the port twice in the application.properties file. It works fine, but again, only for the first time. As you can imagine, I cannot do the same every time the application is launched.
source share