mac下解决tomcat端口被站用问题

xiaoxiao2021-02-28  104

有时候运行程序总会报如下错误:

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).

解决方法:

一、查看站用端口号的进程号

命令:lsof -i :<端口号> 例如:

root$ lsof -i :8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 48168 root 54u IPv6 0x2a670557f4dd04dd 0t0 TCP *:http-alt (LISTEN)

二、杀死站用指定端口号的进程

命令:kill -9 <进程ID> 例如:kill -9 48168

三、重新运行tomcat或者项目

转载请注明原文地址: https://www.6miu.com/read-62227.html

最新回复(0)