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>(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://www.toymoban.com/news/detail-700400.html
文章来源地址https://www.toymoban.com/news/detail-700400.html
到了这里,关于SpringBoot项目配置Eureka时,内嵌TomCat无法启动java.lang.IllegalStateException: StandardEngine[Tomcat].Standa的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!