If your Spring Boot application fails to restart even after stopping it in STS or your IDE, and you see this message:
APPLICATION FAILED TO START
Description:
Web server failed to start. Port 8080 was already in use.
the issue is usually a stale Java process still running in the background.
In my case, the blocking process was javaw.exe.
Symptoms
Your application starts normally:
- Spring context loads
- database connection works
- Liquibase runs
- Hibernate initializes Then it fails at the end with:
Web server failed to start. Port 8080 was already in use.
This means the application itself is fine only the port is blocked.
Root cause
Stopping the server from STS/IDE does not always kill the underlying Java process.
A hidden javaw.exe may still be listening on port 8080.
Solution using Windows CMD
1. Check which PID is using port 8080
netstat -ano | findstr :8080
Example output:
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 10728
TCP [::]:8080 [::]:0 LISTENING 10728
The last number is the PID.
2. Identify the process
tasklist /FI "PID eq 10728"
Example output:
javaw.exe 10728
3. Kill the process
taskkill /PID 10728 /F
Example result:
SUCCESS: The process with PID 10728 has been terminated.
4. Verify the port is free
netstat -ano | findstr :8080
If nothing is returned, port 8080 is free and you can restart your app.
Optional workaround
If needed, run your app on another port temporarily:
server.port=8081
Hope this helps!
Happy Coding!
Thanks,
Kailash
JavaCharter
Top comments (0)