启动某个项目的时候显示端口被占用
例如启动jar包时显示以下报错信息:
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
The Tomcat connector configured to listen on port 8899 failed to start. The port may already be in use or the connector may be misconfigured.
1.查看端口占用情况:
输入 netstat -ano 查看端口占用情况
记得在报错的地方看看是什么端口被占用,我这边是8899端口被占用。
找到被占用的端口,确认端口已被占用
2.通过端口号找进程ID
lsof -i:端口号
比如: lsof -i:8899
找到PID
输入kill -9 进程id
例如kill -9 20051
结束进程,结束之前一定要再三确认进程id,不要弄错
结束之后再重试即可
本文详细介绍了当启动项目遇到端口被占用时的排查及解决步骤,包括如何使用netstat和lsof命令查找占用端口的进程,并通过kill命令结束进程,确保项目正常启动。
1018

被折叠的 条评论
为什么被折叠?



