...其它日志内容
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2026-05-21 10:02:29.296 ERROR 34480 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter 40 :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8899 was already in use.
Action:
Identify and stop the process that's listening on port 8899 or configure this application to listen on another port.
...其它日志内容看到这个日志,第一反应是端口被占用了。通过指令查询后,发现端口并没有占别的进程占用:
netstat -ano | findstr 8899Windows 系统(特别是开启了 Hyper-V、Docker 或 WSL2 后)会随机保留一些端口段供系统内部使用。即使没有程序在监听 8899,只要它落在了系统的“保留区”,任何用户程序(包括 Tomcat)去绑定它都会报错 Port already in use (底层其实是无权访问拒绝绑定)。
排查方法:打开管理员权限的 CMD 或 PowerShell,运行以下命令:
netsh int ipv4 show excludedportrange protocol=tcp终端输出:
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
5357 5357
8424 8523
8524 8623
8624 8723
8724 8823
8824 8923
9015 9114
9115 9214
9215 9314
9315 9414
9415 9514
10366 10465
28385 28385
28390 28390
50000 50059 *
* - Administered port exclusions.果然,8899包含在区间内。
修改spring boot的端口,把 application.yml 里的 server.port 改成一个完全不相干的端口,比如:18899。
重启电脑,重启电脑后,“保留区”的端口会更新。
重启 Windows 动态端口服务
net stop hns
net start hns