Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-28 15:25:12.220 ERROR 39244 --- [ restartedMain] 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.
I changed the ports in the application.properties file. but still get the same error. At first I ran it automatically, but the next day I ran it again and the problem was like this.. I really don't know how to solve it.
CodePudding user response:
As it says in the error. There is another application running on port 8080.
Select a new port to expose or terminate the other application.
CodePudding user response:
You can try netstat
netstat -vanp tcp | grep 8080
or Macosx
lsof -i tcp:8080
or Linux
netstat -vanp --tcp | grep 8080
CodePudding user response:
Generally port 8080
is generally used for a Web Server and I believe is the default for local development with Tomcat; so most likely you have something you have developed running on that port still. I've had this before when Intellij crashes and the Tomcat instance isn't stopped.
You can easily kill it by doing the following:
WINDOWS
Step 1: Open up the command console (cmd.exe), depending on your privileges you may need to run in Administrator; run the following command (Replace <PORT>
with your port number):
netstat -ano | findstr :<PORT>
this will give you a list of services/processes running on port 8080
. What you are interested in is the PID
which is a number located at the end.
Step 2: In the same command console run the following command using the PID
number (Replace <PID>
with your number):
taskkill /PID <PID> /F
Port 8080
should now be free for you to restart your application.
MACOS
For doing the same for MAC please follow this link (Answered copied)
Find out what Process ID (pid) is using the required port (e.g port 5434).
ps aux | grep 5434
Kill that process:
kill -9 <pid>
LINUX
For doing the same for Linux please follow this link (Answered copied)
This
fuser 8080/tcp
will print you PID of process bound on that port.And this
fuser -k 8080/tcp
will kill that process.Works on Linux only. More universal is use of
lsof -i4
(or 6 for IPv6).
Disclaimer: I only checked this on WINDOWS so if using MAC or LINUX and those links worked give credit to those users please.