mac啓動springboot失敗,8080端口被佔用,mac命令行關閉端口

以下圖,idea啓動springboot失敗,8080端口被佔用

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-05-23 22:18:43.688 ERROR 3793 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8020 was already in use.

Action:

Identify and stop the process that's listening on port 8020 or configure this application to listen on another port.

mac下怎麼使用命令行關閉端口呢?

打開mac終端,或者idea的終端,輸入:

lsof -i:端口號(個人是8020,那麼輸入以下命令)
lsof -i:8020

輸入 lsof -i:8020 後回車java

bogon:it399_springboot chenshouyin$ lsof -i:8020
COMMAND  PID        USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    1472 chenshouyin  120u  IPv6 0x71c9463ce2ac6f49      0t0  TCP *:intu-ec-svcdisc (LISTEN)
bogon:it399_springboot chenshouyin$

能夠看到個人端口對應的進程id是1472,那麼kill這個進程便可web

mac下關閉進程

kill 進程id,上面個人進程id是1472,那麼直接輸入以下命令便可spring

kill 1472

關閉佔用端口的進程以後,再啓動springboot再也不報錯了

轉載請註明:本文轉載自在線助手|在線工具博客,原文連接:http://www.it399.com/blog/web/201805251638springboot

相關文章
相關標籤/搜索