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

相关文章
相关标签/搜索