/errors/spring-boot/port-8080-already-in-use
Spring Boot: Web server failed to start. Port 8080 was already in use.
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- Spring Boot
- exit code
- 1
- versions
- Spring Boot 2.x – 4.x
- os
- linux, macos, windows
At startup Spring Boot prints Web server failed to start. Port 8080 was already in use. followed by Action: Identify and stop the process that's listening on port 8080 or configure this application to listen on another port. The embedded web server (Tomcat, Jetty or Undertow) cannot bind the port because another process holds it.
Find what holds the port
lsof -i :8080 # Linux, macOS
ss -ltnp 'sport = :8080' # Linux
netstat -ano | findstr :8080 # Windows, last column is the PIDChange the port
server.port=8081Or for one run, without editing files:
java -jar app.jar --server.port=8081
SERVER_PORT=8081 ./mvnw spring-boot:runserver.port=0 picks a random free port; in tests, @SpringBootTest(webEnvironment = RANDOM_PORT) does the same and injects the chosen port with @LocalServerPort.
Sources
Related pages
errors · expressError: listen EADDRINUSE: address already in use :::3000Node.js and Express fail with listen EADDRINUSE when another process already uses the port. Find it with lsof, ss or netstat, stop it, or listen on a free port.errors · djangoImproperlyConfigured: Requested setting …, but settings are not configuredDjango raises ImproperlyConfigured when code reads settings before DJANGO_SETTINGS_MODULE is set or settings.configure() runs. Set it, then call django.setup().compare · flaskFlask vs FastAPI: differences for building Python web APIsFlask is a minimal WSGI framework where you add validation and docs yourself; FastAPI is async ASGI, validates with type hints and generates OpenAPI docs.