I have strange thing when I try to modify Spring project inside my Spring Tool Suite. On the first load (deploy) everything is fine, application compiles and runs on localho
On Linux Machine, save the bash script and execute it. If you want to free port 8080, Input 8080 when prompted
echo "Enter port number to be closed :: "
read port
sudo kill $(sudo lsof -t -i:$port)
There are some processes left in the background on that port, several reasons can cause this problem, but you can solve easily if you end process which is related to 8080 or Spring.
If you are using Linux there is steps how to end process:
this will kill process which is left on 8080 port and let you run application.
This is a typical startup failure due to the embedded servlet container’s port being in use.
Your embedded tomcat container failed to start because Port 8080 was already in use.
Just Identify and stop the process that's listening on port 8080 or configure (in you application.properties file )this application to listen on another port.
hi creating a simple line in application.properties as SERVER_PORT=8090 solved the issue.
There are two ways to resolve this issue.Try option 1 first, if it doesn't work try option 2, and your problem is solved.
1) On the top right corner of your console, there is a red button, to stop the spring boot application which is already running on this port just click on the red button to terminate.
2) If the red button is not activated you need to right click on the console and select terminate/disconnect all. Hope this helps.
Bonus tip:- If you want to run your server on a different port of your choice, create a file named application.properties in resource folder of your maven project and write server.port=3000 to run your application on port 3000
The reason is one servlet container is already running on port 8080 and you are trying to run another one on port 8080.
Check what processes are running at available ports.
For Windows :
netstat -ao |find /i "listening"
OR
netstat -ano | find "8080"
(Note: 8080 is port fail to start)
Now try to reLaunch or stop your application.
Taskkill /F /IM 6592 Note: Mention correct Process Id
right click on the console and select terminate/disconnect all
Task Manager
and end Java(tm) platform se binaryWhat is java(tm) platform se binary(Search in google
Another option is :
Go to application.properties
file set server.port=0
. This will cause Spring Boot to use a random free port every time it starts.