mac啟動springboot失敗,8080端口被占用,mac命令行關(guān)閉端口

如下圖,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下怎么使用命令行關(guān)閉端口呢?

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

lsof -i:端口號(我的是8020,那么輸入如下命令)
lsof -i:8020

輸入 lsof -i:8020 后回車

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$ 

可以看到我的端口對應(yīng)的進(jìn)程id是1472,那么kill這個進(jìn)程即可

mac下關(guān)閉進(jìn)程

kill 進(jìn)程id,上面我的進(jìn)程id是1472,那么直接輸入如下命令即可

kill 1472

關(guān)閉占用端口的進(jìn)程之后,再啟動springboot不再報錯了

轉(zhuǎn)載請注明:本文轉(zhuǎn)載自在線助手|在線工具博客,原文鏈接:http://www.it399.com/blog/web/201805251638

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容