首页 > 解决方案 > 我正在尝试一个 Spring Boot 示例,但它显示以下错误.. 我该怎么办?

问题描述

启动 ApplicationContext 时出错。要显示条件报告,请在启用“调试”的情况下重新运行您的应用程序。2020-03-26 11:37:05.248 错误 9332 --- [restartedMain] osbdLoggingFailureAnalysisReporter:


应用程序无法启动


描述:

试图调用不存在的方法。尝试是从以下位置进行的:

org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:175)

以下方法不存在:

org.apache.tomcat.util.modeler.Registry.disableRegistry()V

该方法的类 org.apache.tomcat.util.modeler.Registry 可从以下位置获得:

jar:file:/C:/Program%20Files/Java/jre1.8.0_77/lib/ext/tomcat-coyote.jar!/org/apache/tomcat/util/modeler/Registry.class
jar:file:/C:/Users/hp/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar!/org/apache/tomcat/util/modeler/Registry.class

它是从以下位置加载的:

file:/C:/Program%20Files/Java/jre1.8.0_77/lib/ext/tomcat-coyote.jar

行动:

更正应用程序的类路径,使其包含一个兼容的 org.apache.tomcat.util.modeler.Registry 版本

标签: spring-boot

解决方案


请将您的一些代码片段放在这里,例如 application.properties 文件、main 和 ...。或者您可以将您的应用程序推送到 github 并将您的存储库地址放在这里然后我会检查它。


推荐阅读