java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start

Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
 at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:125) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init&gt;(TomcatWebServer.java:87) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:437) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:191) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 ... 8 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
 at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:170) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:109) ~[spring-boot-2.2.8.RELEASE.jar:2.2.8.RELEASE]
 ... 13 common frames omitted

SpringBoot项目可以正常启动,但是一添加@EnableEurekaServer相关注解再启动SpringBoot就报如上错误。我是因为有两个jdk版本一个8一个17.
从根本原因可以看出是SpringBoot的内嵌Tomcat报错,这是因为Jdk版本可能和SpringBoot版本兼容。首先降低SpringBoot版本,用2.7.6或者2.2.8.RELEASE

再看自己配置jdk是否和项目的jdk版本一致 

 

 

 

 

 

最后编辑配置 

 

 

 然后重启idea,重新加载maven就好了!

 

原文地址:https://blog.csdn.net/Li_0127/article/details/128348467

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_13131.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注