cycold / cycold.github.io

Please dot not star...
4 stars 1 forks source link

端口占用问题 #126

Closed cycold closed 8 years ago

cycold commented 8 years ago

启动tomcat服务器,发现只能通过localhost访问,不能通过ip地址访问.

  1. 查看端口占用:
➜  webapp  lsof -i :8080
COMMAND   PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java     9314 i****  202u  IPv4 0xa8577014f8324e35      0t0  TCP *:http-alt (LISTEN)
java    23547 i****  55u  IPv6 0xa8577014f4b555b5       0t0  TCP *:http-alt (LISTEN)

2.查看具体进程详细信息:

➜  webapp  pgrep -lf java
9314 /usr/bin/java -jar /Users/i****/Library/Application Support/Sublime Text 3/Packages/APICloudWiFiSync/tools/wifisync.jar /Users/i****/Developer/playground/APICloud/get_started /Users/i****/Library/Application Support/Sublime Text 3/Packages/APICloudWiFiSync/tools
23547 /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:57111 -Dcatalina.base=/Users/i****/Developer/zlb2/src/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 -Dcatalina.home=/Library/Tomcat -Dwtp.deploy=/Users/i****/Developer/zlb2/src/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps -Djava.endorsed.dirs=/Library/Tomcat/endorsed -Dfile.encoding=UTF-8 -classpath /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/tools.jar org.apache.catalina.startup.Bootstrap start

发现: 8080端口被两个进程给占用了: 1.APICloudWiFiSync 进程 2.tomcat进程

之前访问8080端口, 直接就转到了APICloudWiFiSync进程了, 所以需要关掉APICloudWiFiSync进程

pkill -9 pid or kill pid