You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Eclipse中运行SpringBoot Hello World应用启动失败报错求助

SpringBoot Hello World启动失败(内嵌Tomcat无法启动)解决办法

错误日志:

ApplicationContext启动失败。如需显示条件报告,请启用'debug'模式重新运行应用。
2022-11-05 15:39:12.024 ERROR 16456 --- [           main] o.s.boot.SpringApplication               : 应用运行失败

org.springframework.context.ApplicationContextException: 无法启动bean 'webServerStartStop'; 嵌套异常为org.springframework.boot.web.server.WebServerException: 无法启动内嵌Tomcat服务器
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.23.jar:5.3.23]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.23.jar:5.3.23]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.5.jar:2.7.5]
at com.example.app.HelloWorldDemo.HelloWorldDemoApplication.main(HelloWorldDemoApplication.java:10) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: 无法启动内嵌Tomcat服务器
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.23.jar:5.3.23]
... 14 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:238) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.7.5.jar:2.7.5]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.7.5.jar:2.7.5]
... 16 common frames omitted
Caused by: org.apache.catalina.LifecycleException: 协议处理器启动失败
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1077) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:234) ~[tomcat-embed-core-9.0.68.jar:9.0.68]
... 18 common frames omitted

核心原因分析

从栈追踪可定位到,协议处理器启动失败是内嵌Tomcat无法启动的根本原因,常见触发场景包括:端口被占用、JDK版本不兼容、项目依赖冲突、Tomcat配置异常。

解决方案

  • 检查端口占用

    • Windows系统:打开命令提示符,执行netstat -ano | findstr :8080(替换8080为你的应用端口),找到占用端口的PID后,打开任务管理器结束对应进程。
    • 或修改SpringBoot端口:在application.properties中添加server.port=8081,或在application.yml中添加:
      server:
        port: 8081
      
  • 验证JDK版本兼容性

    • SpringBoot 2.7.x要求JDK 8及以上,在Eclipse中右键项目→Properties→Java Build Path→Libraries,确认JRE System Library版本符合要求;同时检查Project Facets中的Java版本与JDK版本一致。
  • 清理重建项目

    • 在Eclipse中执行Project→Clean...,选择目标项目清理;若为Maven项目,右键项目→Maven→Update Project,勾选Force Update of Snapshots/Releases,更新依赖后重新启动应用。
  • 排查依赖冲突

    • 打开pom.xml,确保仅引入spring-boot-starter-web依赖,不要手动添加独立的Tomcat依赖——SpringBoot starter已经内嵌了适配版本的Tomcat,手动引入会导致版本冲突。

内容的提问来源于stack exchange,提问作者Hinthuu Priya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 13:15:15