1

While launching spring-boot application, I am always getting the below error. I tried changing the ports to 8181, 8585, 9191, etc but still the same error.

I tried everything mentioned in Launching Spring application Address already in use but nothing worked for me. Also, this was working fine until yesterday and stopped working when I added spring-actuator related maven dependency and properties (this is my observation not sure even if it is related).

Error :

2021-05-20 18:15:21.283 DEBUG 10256 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 
Application failed to start due to an exception

org.springframework.boot.web.server.PortInUseException: Port 8080 is already in use
at org.springframework.boot.web.server.PortInUseException.lambda$throwIfPortBindingException$0(PortInUseException.java:70) ~[spring-boot-2.4.5.jar:2.4.5]
***************************
APPLICATION FAILED TO START
***************************

Description:

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

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

My application.properties:

logging.level.org.springframework = debug
server.port=8080
management.endpoints.web.exposure.include=*

Any suggestion, please ? Thanks for your help in advance.

borkarda
  • 95
  • 1
  • 8
  • 1
    Reboot your machine - that will ensure any straggling processes are stopped that may be using that port. Alternatively, you can get into your process manager and quit every process labeled "java" or "tomcat" or "jetty" - that also may work. Good luck. – Randy Casburn May 20 '21 at 15:29
  • Problem solved by restarting the machine. I observed that the application was not starting from eclipse but still I was able to hit the URLs for my web services and I was getting the response. Thanks @Randy Casburn for your help. – borkarda May 21 '21 at 08:35

2 Answers2

2

There must be some application running or already using port 8080 in your system. Here are few suggestions that might help.

open command prompt and try : 
> netstat -aon | find /i "8080"

output> 
TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       13568
TCP    [::]:8080              [::]:0                 LISTENING       13568

The last number shown in the above output is PID for running port 8080, try to kill that process. Note: PID might differ in your system

>taskkill /F /PID 13568

If this doesn't work, then try restating your IDE and change the port. Also, you mentioned that problem started when you added actuator dependencies. Please check once by removing those dependencies and properties, not sure if hal-explorer is creating the problem.

Swatee
  • 46
  • 4
1

enter image description here

enter image description here

Problem is solved Thanks :))))

Zaur
  • 206
  • 2
  • 4