I thank you in advance for your help
I am currently starting a Spring Boot project (Gradle) and when I run the ./gradlew bootRun
command on my VScode terminal, I get the following message:
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.
Task :bootRun FAILED
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':bootRun'.
Process 'command '/Library/Java/JavaVirtualMachines/jdk-17.0.5.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
The problem is that I wasn't using my port 8080 at all (unless I'm mistaken, and if I am I don't know how to check it).
I feel more like I have a problem with my JAVA.
I will be very grateful to you for helping me find a solution to this problem. Thanking you in advance :)
CodePudding user response:
Windows
netstat -aon | findstr 8080
Unix/Linux/Mac
lsof -i :8080
Then you can proceed/kill with (process explorer/)tasklist/ps
... Thx to:
- https://dzone.com/articles/how-to-check-which-process-is-using-port-8080-or-a
- https://mkyong.com/linux/linux-which-application-is-using-port-8080/
- https://mkyong.com/mac/mac-osx-what-program-is-using-port-8080/
CodePudding user response:
It has never happened to me before, But some other application can be using port 8080
You can check with CMD as Administrator by using netstat
command like this
netstat -a -b | findstr "8080"
This will show who is using this port.
To overcome this issue, You can easily go to application.properties
and add
server.port = 8081
This will make the application to be run over port 8081
all the time.
And you can do it with one time setup by adding args to gradle bootrun
like this
gradle bootrun --args='--server.port=8081'
This will result of running the server over port 8081
for one time only.