Tomcat 启动报错:
Several ports (8005, 8080, 8009) required by Tomcat v9.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).
1.Windows 查看端口命令
可以判断8080、8009端口已经被占用,通过以下方法,找出被哪个进程占用:
在命令提示符下,输入netstat -aon | findstr 8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 103320
TCP 172.16.10.4:57215 59.37.96.203:8080 ESTABLISHED 12456
TCP [::]:8080 [::]:0 LISTENING 103320
获得该端口被PID为103320的进程占用
输入tasklist |findstr 103320
Tomcat9.exe 103320 Services 0 40,148 K
继续输入taskkill -F -IM Tomcat9.exe或taskkill /pid 103320 /F
结束该进程
如果结束进程失败
Ctrl+Shift+Esc 快捷键进入任务管理器
Window10中进入详细信息找到对应的PID,右键结束任务
再次在eclipse中启动tomcat正常
2.修改tomcat默认端口号
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Connector 节点,将port="8080"中的端口改为一个没有被占用的端口
netstat -ano 和 netstat -aon即可查看端口使用情况,2个命令一样
参考:
Eclipse启动Tomcat错误
更改tomcat端口号方法
Tomact官网
Eclipse 配置Tomact