我有一个带J2EE的Web应用程序项目,我想用apache tomcat在端口80上运行我的web应用程序,我给出了这个错误:
4:31:34 PM运行错误测试:地址localhost:80已在使用中 4:31:37 PM运行错误测试:无法打开调试器端口:java.net.SocketException" Socket closed"
我使用此命令显示所有进程
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)
并且对于此命令我给出了这个输出
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或etc中的另一个进程是从端口80使用的。 有什么想法吗?
答案 0 :(得分:0)
尝试$ 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但没有禁用该服务......这就是它对我的看法。也许它已经通过timeMachine恢复在后台重置
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist