MAC的IntelliJ IDEA无法运行Web项目上的端口80
问题描述:
我有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使用。 有什么想法吗?
答
尝试$ sudo lsof -Pn -i | grep ":80 (LISTEN)"
我想你会得到这样的
httpd 6477 root 5u IPv6 0x261be06accde8493 0t0 TCP *:80 (LISTEN)
httpd 6484 _www 5u IPv6 0x261be06accde8493 0t0 TCP *:80 (LISTEN)
这意味着:你的Mac Web服务正在运行。 如果您使用的是Mountain Lion或更新版本,我也希望您在旧版操作系统版本中通过sharing dialog启用了它。不幸的Apple removed this setting但没有禁用服务......这是它对我的看法。或许它已经通过时间机器重置背景恢复得
- 临时卸载:
sudo apachectl stop
-
permanent unload:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
难道当你运行你的第一次项目这个错误发生的呢? – 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)以获取更多信息。 –