I can successfully start spring-boot with mvn spring-boot
, the documentation mentions to gracefully exit the application hit ctrl-c
.
I encountered same problem running SpringBoot application in eclipse on Mac. I manually had to find all the PID's using 8080 and kill them. But, fortunately, I realized that we can kill that tomcat instance right from the eclipse "console" view, by hitting the stop(Red square icon) button and run the spring boot application again.
This solution worked for me with Spring Boot v1.x und works now, with v2.x:
hangingJavaProcessToStop=`jps | grep Application | awk '{print $1}'`
echo "hangingJavaProcessToStop: $hangingJavaProcessToStop"
kill -9 $hangingJavaProcessToStop
This way you can kill specifically Spring Boot's Application
Java process instead of killing all Java processes at once. I assume if your Spring Boot "Application" (main
method containing class) is called differently, you must use its name instead of Application
.
I am running the snippet above, on my Windows machine using WSL/Debian. I am not using PowerShell or Windows'command line.
Here is what I do on Mac:
kill `lsof -i -n -P | grep TCP | grep 8080 | tr -s " " "\n" | sed -n 2p`
It finds the PID using 8080 and kills it.
If you are using NetBeans you can stop the server or process by clicking on the cross icon in the bottom right corner where it says Run (Project name).
For those using Eclipse, this is by far the best answer:
Open "run configurations", edit the maven launch you defined for your project, and under the "JRE" tab, add -Dfork=false to the VM arguments text area.
Then when you hit the red stop button, the tomcat server will stop and your ports will be released.
Answer comes from a post here on Github by jordihs
I had the same issue in Windows 10, wenn I was running mvn spring-boot:run
in a Cygwin Terminal. I wasn't even able to find the Tomcat process in Cygwin using ps -ef
; I had to search for the process in PowerShell using netstat -ao
.
Using mvn spring-boot:run
in PowerShell is working fine for me.