Eclipse在Run on Server时,Tomcat是开启的,但是报错,显示8080、8005和8009端口被占用
终端输入
查看所有开启的端口
sudo lsof -i -P | grep -i "listen"
出现如下
httpd 79 root 4u IPv6 0xbc257c1a68e3d681 0t0 TCP *:80 (LISTEN)
mysqld 95 _mysql 30u IPv6 0xbc257c1a68e3d121 0t0 TCP *:3306 (LISTEN)
httpd 277 _www 4u IPv6 0xbc257c1a68e3d681 0t0 TCP *:80 (LISTEN)
adb 673 WangChunQian 7u IPv4 0xbc257c1a7972ea39 0t0 TCP localhost:5037 (LISTEN)
AlipayDis 2154 root 16u IPv4 0xbc257c1a8440f341 0t0 TCP localhost:27382 (LISTEN)
java 8900 root 48u IPv6 0xbc257c1a68e3dbe1 0t0 TCP *:8080 (LISTEN)
java 8900 root 49u IPv6 0xbc257c1a73b70121 0t0 TCP *:8009 (LISTEN)
java 8900 root 56u IPv6 0xbc257c1a68e3cbc1 0t0 TCP localhost:8005 (LISTEN)
Office365 8916 WangChunQian 5u IPv4 0xbc257c1a6f146c49 0t0 TCP localhost:1538 (LISTEN)
其中第二列是PID
然后根据PID杀进程:
sudo kill -9 8900
重新Run on server正常
来源:https://www.cnblogs.com/mantti/p/5262902.html