我在Spring Tool Suite IDE中使用嵌入式Tomcat服务器。我的问题是当我运行我的项目时出现如下错误,
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
有一些类似的问题,但没有一个答案不适合我。
解决方案1:杀死进程
以管理员身份运行命令行
netstat -ano | findstr :<yourPortNumber>
taskkill /PID <typeyourPIDhere> /F
解决方案2:更改端口
请确保您要为应用程序设置的新端口不会侦听任何其他进程
Change the port
server.port=8088 # Server HTTP port.
解决方案3:另一种方法是终止进程(在IDE中)并清理和重建项目。
更新:
对于解决方案2,请确保您要为应用程序设置的新端口不会侦听任何其他进程。
选项1
运行resmon.exe
并转到Network -> Listening Port
(也可以在TaskManager上查看)
选项2
电源外壳
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
CMD
C:\> netstat -a -b
(添加-n以阻止它尝试解析主机名,这将使其更快。)
-a
显示所有连接和侦听端口。
-b
显示创建每个连接或侦听端口所涉及的可执行文件。在某些情况下,众所周知的可执行文件承载多个独立组件,在这些情况下,将显示创建连接或侦听端口所涉及的组件序列。在这种情况下,可执行文件名在底部的[]中,顶部是它调用的组件,依此类推,直到达到TCP / IP。请注意,此选项可能非常耗时,并且除非您具有足够的权限,否则将失败。
-n
以数字形式显示地址和端口号。
-o
显示与每个连接关联的拥有进程ID。
我发现PatelRomil的答案对我不起作用。我发现通过运行:
netstat -a -o -n
获取端口的PID,然后运行:
taskkill /F /PID [PID]
为我工作。将[PID]
替换为上一个命令中表中的值。