1. 程式人生 > >錯誤記錄--更改tomcat埠號方法,Several ports (8005, 8080, 8009)

錯誤記錄--更改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,將它結束掉。如果問題沒有解決,往下看。 如果沒有這個程序,那可能是其他軟體佔用了埠。 在開始選單->執行->cmd->輸入 netstat   -ano 或netstat -an | grep 8080 命令,可以檢視哪個程序佔用了8080和8009埠,找到佔用埠軟體的PID,然後在工作管理員找到對應PID的軟體,關閉結束該程序即可。如果工作管理員中沒有顯示PID列,需要設定,檢視---》選擇列---》勾選“PID(程序識別符號)”。

方法2:修改tomcat預設埠號

開啟Tomcat的安裝路徑E:\software\apache-tomcat-8.5.32\conf

找到conf資料夾下的server.xml檔案用記事本開啟

找到8080改成9090   其他地方的8080不需要改  建議改之前拷貝一個server.xml以免改錯

這樣就不會有8080埠衝突了  但是我不會用這種方法改8005  8009

方法3:雙擊伺服器

如圖所示: