一直使用Mac做開發(fā),偶然一次啟動Mac中eclipse中的tomcat時報錯:
Several ports (8080, 8009) required by Tomcat v7.0
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).
在網(wǎng)上查找資料大多是Windows上解決的辦法!
現(xiàn)在說一說Mac下的解決的辦法:
- 打開終端,確定被占用的端口號,輸入以下命令:
lsof -i :8080
- 該命令會輸出下圖所示內(nèi)容:
Snip20161116_2.png
- 我的電腦上被占用8080端口的進(jìn)程ID是698,所以干掉這個進(jìn)程就OK了
kill -9 698
- 根據(jù)你的進(jìn)程ID更改最后的一個參數(shù),在終端輸入后回車,然后重啟Eclipse,tomcat可以正常啟動了!