Terminating mvn spring-boot:run doesn't stop tomcat

后端 未结 18 1255
别那么骄傲
别那么骄傲 2020-12-04 07:11

I can successfully start spring-boot with mvn spring-boot, the documentation mentions to gracefully exit the application hit ctrl-c.



        
相关标签:
18条回答
  • 2020-12-04 08:08

    For Powershell, put the following code in a file ending with '.ps1' $processes = (get-NetTCPConnection| ? {$_.LocalPort -eq "8080"}).OwningProcess foreach ($process in $processes) {Get-Process -PID $process | Stop-Process -Force}

    0 讨论(0)
  • 2020-12-04 08:11

    Yes this is correct that when you do a maven install with spring-boot-run and after the application is stopped, tomcat port still listens.

    I am attaching a screenshot for those who faced this problem port/address already in use. What you have to do is before running the spring boot application again,just go to your windows Task manager and end the Process named "Java(TM) Platform SE binary" and run your boot application your port would be free of the process and you wont get the issue again.(You don't have to do this after you run your application for the first time ) It worked miracle for me. Hope it helps Good day

    0 讨论(0)
  • 2020-12-04 08:12

    I know i am too late to answer but may be some one get help with this. STS users can use the Relaunch button rather than Run to ensure that any existing instance is closed.
    For Reference :
    https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html

    0 讨论(0)
  • 2020-12-04 08:12

    That only happens in Windows. https://github.com/spring-projects/spring-boot/issues/773

    Update: should be fixed now.

    0 讨论(0)
  • 2020-12-04 08:12

    I fall in the same issue, but there is a much better and simple way to run your Spring boot app that does not have this problem.

    Run As -> Java Application

    Update: Furthermore, if you use Spring STS (available for VS Code, IntelliJ, Eclipse...) you have the chance to manage your application from the Boot Dashboard. It's really useful.

    0 讨论(0)
  • 2020-12-04 08:13

    We can kill that tomcat instance right from the eclipse console view, by hitting the stop (Red square icon) button and Red button beside the run icon, run the spring boot application again.

    0 讨论(0)
提交回复
热议问题