Unable to start embedded Tomcat错误解决

@TOCUnable to start embedded Tomcat错误解决
最近在学习springcloud,都是原理,自己搭建下看看,当然是先从eurika开始,遇到报错如下(内容太多就不全部贴出来了):

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
at com.gupao.gun.GunApplication.main(GunApplication.java:13) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]

网上搜索了一下,都说是springcloud版本和springboot版本不一致引起的
我使用的springcloud版本是Hoxton.SR3, 网上搜索得知对应springboot 2.2.X,好统一修改2.2.5,但是还是报错,思路没转换过来,继续在这个方向上纠结,会不会是版本太新的原因呢,把springcloud换成热门版本Greenwich.SR3,spirngboot换成2.1.9,悲剧,引起之前构建的其他幻境的报错,想想还是恢复Hoxton.SR3版本,纠结了几个小时,想起pom中引用了这么一段

 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>

会不会是eureka组件与springcloud版本不一致呢,到maven官网去搜索Spring Cloud Dependencies,找到Hoxton.SR3,下拉,看到:
在这里插入图片描述
之前也看到这,但是没看懂,根据我引用的组件在netflix下,所以猜测是我标出的位置,于是把版本换成了:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            <version>2.2.2.RELEASE</version>
        </dependency>

问题解决

总结
springcloud的版本不光要与springboot版本对应,组件版本也需要与大版本一致,希望遇到相同问题的朋友可以节约时间。

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值