1

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 :)

1
  • 1
    On Linux, you can check with lsof: lsof -i | grep :8080, on MacOS use lsof -i -P | grep :8080. No idea how to do this on Windows. Maybe your previous run didn't terminate. Check if something is still running. Maybe restarting VS Code helps. Commented Nov 2, 2022 at 15:00

2 Answers 2

2

Windows

netstat -aon | findstr 8080

Unix/Linux/Mac

lsof -i :8080

Then you can proceed/kill with (process explorer/)tasklist/ps... Thx to:

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.