-1

enter image description herefile application.properties

enter image description here

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.

Learnjava
  • 1
  • 1
  • Did you try doing the thing that it tells you to do? – jonrsharpe Feb 28 '22 at 08:43
  • 8080 already in use. Close whatever is using it first. – Antoniossss Feb 28 '22 at 08:45
  • sorry, but i have changed a lot of ports, but still get the error message used. can you give me 1 port to test? thank you – Learnjava Feb 28 '22 at 08:48
  • How and where did you change ports? – dunni Feb 28 '22 at 08:52
  • I replaced the port in the file application.properties @dunni – Learnjava Feb 28 '22 at 08:54
  • @dunni 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. – Learnjava Feb 28 '22 at 09:22
  • First you should check, what process is already listening on that port. See the following Q&A for Windows: https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-tcp-or-udp-port-on-windows or that one for Linux: https://stackoverflow.com/questions/39974335/how-to-determine-which-process-is-using-a-port-in-linux or that one for Mac: https://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x – dunni Feb 28 '22 at 09:25

3 Answers3

0

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.

Gigi_men
  • 11
  • 1
0

You can try netstat

 netstat -vanp tcp | grep 8080

or Macosx

 lsof -i tcp:8080 

or Linux

 netstat -vanp --tcp | grep 8080
bcorpse
  • 1
  • 2
0

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>

enter image description here

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

enter image description here

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.

Popeye
  • 11,839
  • 9
  • 58
  • 91
  • i did your way, but still not able to handle the error. Yesterday, I ran the program normally, but now I don't understand why this problem occurs – Learnjava Feb 28 '22 at 09:56
  • After killing port `8080` if you run `netstat -ano | findstr :` again does it say something is using the port still? – Popeye Feb 28 '22 at 09:57
  • i tried it under macos, but it didn't solve the problem – Learnjava Feb 28 '22 at 10:00