Home > Software design >  Port 8080 is already in use
Port 8080 is already in use

Time:09-17

The method works properly without path variable but then when I write path variable and run app it says port 8080 is already in use

@GetMapping(path="/{userId}")
public String getUser(@PathVariable String userId) {
    return "Get User Info with id " userId;
}

CodePudding user response:

On mac, try this

sudo lsof -i :8080

# get the process id from here and run

kill -9 <process_id>

CodePudding user response:

I solved it, on Windows

netstat ano | findstr 8080 

taskkill /F /PID <number of task>

CodePudding user response:

First your issue is not with Path variable, Port 8080 is been used by some other application

Command for Linux,

sudo netstat -nlap | grep 8080
sudo kill <process id>

Command for Windows

netstat -ano | findstr :8080
taskkill /PID <process id> /F

If any application uses the port 8080, it will return the process id.

  • Related