2
我有J2EE Web應用程序的項目,我想運行在80端口與Apache Tomcat上我的web應用程序,我給這個錯誤:MAC的IntelliJ IDEA無法運行Web項目上的端口80
4 :31:34 PM錯誤運行測試:地址本地主機:80已在使用 下午4時31分37秒的錯誤運行測試:無法打開調試端口:java.net.SocketException異常「套接字關閉」
我使用此命令顯示所有進程
Meysams-MacBook-Pro:~ meysamfatheepanah$ lsof -Pn -i4
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
UserEvent 309 meysamfatheepanah 4u IPv4 0x680181e2905eeb01 0t0 UDP *:*
SystemUIS 341 meysamfatheepanah 9u IPv4 0x680181e2905ed559 0t0 UDP *:*
SystemUIS 341 meysamfatheepanah 10u IPv4 0x680181e2905f00a9 0t0 UDP *:*
SystemUIS 341 meysamfatheepanah 13u IPv4 0x680181e2905ed2f1 0t0 UDP *:57792
SystemUIS 341 meysamfatheepanah 15u IPv4 0x680181e2905ed089 0t0 UDP *:*
sharingd 366 meysamfatheepanah 24u IPv4 0x680181e2905edc91 0t0 UDP *:*
sharingd 366 meysamfatheepanah 28u IPv4 0x680181e28eeb3fd1 0t0 UDP *:*
WiFiAgent 444 meysamfatheepanah 7u IPv4 0x680181e2905ec219 0t0 UDP *:*
Telegram 584 meysamfatheepanah 23u IPv4 0x680181e29016bba1 0t0 TCP 192.168.1.61:49367->91.108.4.170:443 (ESTABLISHED)
idea 1236 meysamfatheepanah 21u IPv4 0x680181e2944c39b1 0t0 TCP 127.0.0.1:51541 (LISTEN)
idea 1236 meysamfatheepanah 35u IPv4 0x680181e29f19aba1 0t0 TCP 127.0.0.1:51541->127.0.0.1:51670 (ESTABLISHED)
idea 1236 meysamfatheepanah 95u IPv4 0x680181e292c33ba1 0t0 TCP 127.0.0.1:6942 (LISTEN)
idea 1236 meysamfatheepanah 164u IPv4 0x680181e2905ec6e9 0t0 UDP 192.168.1.61:53244
idea 1236 meysamfatheepanah 165u IPv4 0x680181e2905f0a49 0t0 UDP *:9876
idea 1236 meysamfatheepanah 624u IPv4 0x680181e2939c30b9 0t0 TCP 127.0.0.1:63342 (LISTEN)
idea 1236 meysamfatheepanah 625u IPv4 0x680181e2936275d1 0t0 TCP *:2864 (LISTEN)
idea 1236 meysamfatheepanah 626u IPv4 0x680181e2905bb709 0t0 UDP *:2863
idea 1236 meysamfatheepanah 770u IPv4 0x680181e29361b9b1 0t0 TCP 192.168.1.61:51539->208.68.163.218:5222 (ESTABLISHED)
java 1329 meysamfatheepanah 123u IPv4 0x680181e293619ec9 0t0 TCP 127.0.0.1:51670->127.0.0.1:51541 (ESTABLISHED)
firefox 1331 meysamfatheepanah 37u IPv4 0x680181e29325b7c1 0t0 TCP 192.168.1.61:51739->172.217.18.226:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 41u IPv4 0x680181e2944862a9 0t0 TCP 192.168.1.61:51692->198.252.206.25:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 42u IPv4 0x680181e29325dba1 0t0 TCP 192.168.1.61:51736->74.125.206.94:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 43u IPv4 0x680181e2929fc2a9 0t0 TCP 192.168.1.61:51804->50.31.164.173:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 44u IPv4 0x680181e2939c42a9 0t0 TCP 192.168.1.61:51737->216.58.208.238:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 50u IPv4 0x680181e29f06d9b1 0t0 TCP 192.168.1.61:51733->172.217.19.131:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 54u IPv4 0x680181e2929f9ec9 0t0 TCP 192.168.1.61:51682->216.58.208.238:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 59u IPv4 0x680181e294498ba1 0t0 TCP 192.168.1.61:51738->216.58.208.238:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 61u IPv4 0x680181e29362a2a9 0t0 TCP 192.168.1.61:51686->216.58.211.100:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 71u IPv4 0x680181e29448a9b1 0t0 TCP 192.168.1.61:51673->104.16.112.18:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 74u IPv4 0x680181e29f0a75d1 0t0 TCP 192.168.1.61:51791->64.233.167.95:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 75u IPv4 0x680181e2944d79b1 0t0 TCP 192.168.1.61:51753->198.252.206.25:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 79u IPv4 0x680181e2929fb0b9 0t0 TCP 192.168.1.61:51798->216.58.208.200:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 82u IPv4 0x680181e2929fcba1 0t0 TCP 192.168.1.61:51799->23.235.43.175:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 87u IPv4 0x680181e294482ba1 0t0 TCP 192.168.1.61:51800->50.31.164.172:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 88u IPv4 0x680181e2932997c1 0t0 TCP 192.168.1.61:51774->216.58.208.227:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 92u IPv4 0x680181e29f13c7c1 0t0 TCP 192.168.1.61:51767->198.252.206.25:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 93u IPv4 0x680181e292c305d1 0t0 TCP 192.168.1.61:51802->23.51.123.27:80 (ESTABLISHED)
firefox 1331 meysamfatheepanah 95u IPv4 0x680181e2944c30b9 0t0 TCP 192.168.1.61:51785->23.51.123.27:80 (ESTABLISHED)
firefox 1331 meysamfatheepanah 101u IPv4 0x680181e296a4f7c1 0t0 TCP 192.168.1.61:51768->172.217.20.42:443 (ESTABLISHED)
和用於此指令i給這個輸出
Meysams-MacBook-Pro:~ meysamfatheepanah$ sudo lsof -nP -iTCP -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
idea 1236 meysamfatheepanah 21u IPv4 0x680181e2944c39b1 0t0 TCP 127.0.0.1:51541 (LISTEN)
idea 1236 meysamfatheepanah 95u IPv4 0x680181e292c33ba1 0t0 TCP 127.0.0.1:6942 (LISTEN)
idea 1236 meysamfatheepanah 624u IPv4 0x680181e2939c30b9 0t0 TCP 127.0.0.1:63342 (LISTEN)
idea 1236 meysamfatheepanah 625u IPv4 0x680181e2936275d1 0t0 TCP *:2864 (LISTEN)
Meysams-MacBook-Pro:~ meysamfatheepanah$ netstat -atp tcp | grep -i "listen"
tcp4 0 0 localhost.51541 *.* LISTEN
tcp4 0 0 *.astromed-main *.* LISTEN
tcp4 0 0 localhost.63342 *.* LISTEN
tcp4 0 0 localhost.6942 *.* LISTEN
我認爲另一進程OSX或等從端口80使用。 有什麼想法嗎?
難道當你運行你的第一次項目這個錯誤發生的呢? – Blank
是的,我第一次運行項目時出現此錯誤,我必須在我的項目中使用此端口80。 –
這不適用於Mac,因爲它不適用於任何其他基於Unix的操作系統。請參閱[爲什麼需要sudo才能啓動給定ip:端口上的Web服務器?](http://superuser.com/questions/289833/why-is-sudo-required-to-start-up-a-webserver- on-a-given-ipport/289844#289844)以獲取更多信息。 –