0

When starting/relaunching a Spring Boot App and the app runs on a port which was already in use before I got an error:

Web server failed to start. Port 8092 was already in use.

So, everytime I am starting a Spring Boot App I have to switch server.port in application.properties.

Note: Because I do not have the Run as "Spring Boot App" I use the work around mentioned here to start it: First Answer, How to run Spring Boot web application in Eclipse itself?

Is there a solution to avoid switching ports every time?

Thanks a lot!

Tobitor
  • 1,388
  • 1
  • 23
  • 58
  • 2
    Do you need to switch ports every time you relaunch your application? If so that means the old instance is not killed properly. – SnowmanXL Oct 27 '20 at 09:00
  • Yes, I have to switch everytime... How could I kill it properly? I used the buttons "Terminate", "Remove Launch" and "Remove All Terminated Launches" but had no success so far. – Tobitor Oct 27 '20 at 09:07
  • When you terminate, ideally it should have terminated your previous instance and you should be able to launch the new instance on same instance (without changing the port in properties file) – Nisarg Patil Oct 27 '20 at 09:36
  • Does this help? https://stackoverflow.com/questions/49643234/spring-boot-spring-bootrun-in-eclipse-does-not-kill-background-java-process – SnowmanXL Oct 27 '20 at 09:36
  • 1
    Go to command line and manually kill process using the related port – akuma8 Oct 27 '20 at 09:48
  • akuman8's answer helped. Thanks! It is solved. – Tobitor Oct 27 '20 at 10:28

0 Answers0