How to solve: Port 8080 was already in use (Linux)

I’ve been learning Java and Spring Batch for about a week now. This is the framework we’ve been using at my job, and I’m trying to create my own project to familiarize myself with these skills. However, I encountered an error that says, ‘Web server failed to start. Port 8080 was already in use.’

And here’s how I solved it.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-10-07 12:04:48.034 ERROR 11455 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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.
sudo lsof -i :8080
user@host:~$ sudo lsof -i :8080
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    11397 mr_linux   55u  IPv6  73090      0t0  TCP *:http-alt (LISTEN)
sudo kill PID

Leave a Reply