五:Eclipse執行tomcat遇到Several ports (8005, 8080, 8009)
啟動Tomcat伺服器報錯:
Several ports (8005, 8080, 8009) required by Tomcat v5.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
原因:埠8005, 8080, 8009被佔用了。可能是在開啟Tomcat的情況下關閉了Eclipse,或是Eclipse非正常關閉,導致先前的Tomcat沒有被關閉,端口占用。或是其他軟體佔用了tomcat的埠號。
解決方法: 方法1:殺掉佔用埠的軟體。
開啟工作管理員,找到java虛擬機器相關的程序javaw.exe,將它結束掉。如果問題沒有解決,往下看。 如果沒有這個程序,那可能是其他軟體佔用了埠。 控制檯輸入指令
netstat -ano 或netstat -an | grep 8080 命令,可以檢視哪個程序佔用了8080和8009埠,找到佔用埠軟體的PID
關閉或殺掉佔用該埠的軟體或PID
1.在工作管理員找到對應PID的軟體,關閉結束該程序即可。如果工作管理員中沒有顯示PID列,需要設定,檢視---》選擇列---》勾選“PID(程序識別符號)”
2.後臺刪掉,使用指令 kill -9 26105 (徹底刪掉)
方法2:修改tomcat預設埠號。
修改Tomcat的配置檔案。 例如:C:/tomcat5.5.25/conf/server.xml <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />
Connector 節點,將port="8080"中的埠改為一個沒有被佔用的埠。