I have strange thing when I try to modify Spring project inside my Spring Tool Suite. On the first load (deploy) everything is fine, application compiles and runs on localhost:8080
When I change something inside code and try to redeploy it (Run it again - Run As Spring Boot App) I get error message
*************************** APPLICATION FAILED TO START
Description:
The Tomcat connector configured to listen on port 8080 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 8080, or configure this application to listen on another port.
2016-10-19 00:01:22.615 INFO 10988 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3023df74: startup date [Wed Oct 19 00:01:19 CEST 2016]; root of context hierarchy 2016-10-19 00:01:22.616 INFO 10988 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
If I shutdown process on that port manually everything works fine again, but this can't be right way of redeploying Spring app. Am I doing something wrong here?
I'm using :: Spring Boot :: (v1.4.1.RELEASE)
P.S. I'm aware that I can setup some kind of hot-swap mechanism to have automatic reload of page after I change code, but for now I would like to resolve this issue first.
Thanks for any kind of help or info.
Open "localhost:8080" on your browser and see what is running on this port. I did it and I just found Oracle 10g XE running on background, so I went to start->Services and stopped all oracle services. Then I redo
mvnw spring-boot:run
on IntelliJ and it runs like magic.There are two ways to resolve this issue.Try option 1 first, if it doesn't work try option 2, and your problem is solved.
1) On the top right corner of your console, there is a red button, to stop the spring boot application which is already running on this port just click on the red button to terminate.
2) If the red button is not activated you need to right click on the console and select terminate/disconnect all. Hope this helps.
Bonus tip:- If you want to run your server on a different port of your choice, create a file named application.properties in resource folder of your maven project and write server.port=3000 to run your application on port 3000
This is a typical startup failure due to the embedded servlet container’s port being in use.
Your embedded tomcat container failed to start because Port 8080 was already in use.
Just Identify and stop the process that's listening on port 8080 or configure (in you application.properties file )this application to listen on another port.
Just click red button to stop all services on eclipse than re- run application as Spring Boot Application - This worked for me.
If you are using linux system, use the below command.
fuser -k some_port_number/tcp
- that will kill that process.Sample:-
fuser -k 8080/tcp
No Need to manually start an application every time at time of development to implements changes use 'spring-boot-devtool' maven dependency.
When you have the spring-boot-devtools module included, any classpath file changes will automatically trigger an application restart. We do some tricks to try and keep restarts fast, so for many microservice style applications this technique might be good enough.