【问题标题】:Upgraded spring boot from 2.1.0 to 2.2.2.RELEASE , now getting exception while starting将 spring boot 从 2.1.0 升级到 2.2.2.RELEASE ,现在启动时出现异常
【发布时间】:2020-04-26 02:23:36
【问题描述】:

我将SpringBoot版本2.1.0升级到2.2.2.RELEASE

java:openjdk11 弹簧启动:v2.2.0.RELEASE springCloudVersion : Hoxton.RC1

错误:

应用程序启动失败

说明:

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

springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)

以下方法不存在:

 org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang> /Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;

该方法的类 org.springframework.plugin.core.PluginRegistry 可从以下位置获得:

jar:file:/home/cuelogic.local/kanisha.modi/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar!/org/springframework/plugin/core/PluginRegistry.class

它是从以下位置加载的:

file:/home/cuelogic.local/kanisha.modi/.gradle/caches/modules-2/files-2.1/org.springframework.plugin/spring-plugin-core/2.0.0.RELEASE/95fc8c13037630f4aba9c51141f535becec00fe6/spring-plugin-core-2.0.0.RELEASE.jar

行动:

更正应用程序的类路径,使其包含一个兼容的 org.springframework.plugin.core.PluginRegistry 版本

引起的错误
 Caused by: java.lang.NoSuchMethodError:
 org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin;
    at
 springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152)
    at
 springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.defaultContextBuilder(DocumentationPluginsBootstrapper.java:106)
    at
 springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.buildContext(DocumentationPluginsBootstrapper.java:91)
    at
 springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:154)
    at
 org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
    ... 101 common frames omitted

build.gradle

dependencies {
    
    compile "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client"
    compile "io.opentracing.contrib:opentracing-spring-jaeger-cloud-starter:1.0.1"
    compile "org.springframework.boot:spring-boot-starter"
    compile "org.springframework.boot:spring-boot-starter-amqp"
    compile "org.springframework.boot:spring-boot-starter-web"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.springframework.boot:spring-boot-starter-security"
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-starter-data-rest"
    compile "org.springframework.boot:spring-boot-starter-data-mongodb"
    compile "org.springframework.boot:spring-boot-starter-aop"
    compile "org.springframework:springloaded:1.2.8.RELEASE"
    compile "org.springframework.security:spring-security-web"
    compile "org.springframework.security:spring-security-config"
    compile "org.apache.commons:commons-collections4:4.1"
    compile "com.fasterxml.jackson.core:jackson-databind:2.9.10"
    compile "com.google.guava:guava:${guava_version}"
    compile(group: 'io.springfox', name: 'springfox-swagger2', version: '2.7.0') {
        exclude(module: 'guava')
    }
    compile "javax.cache:cache-api:1.1.0"
    compile "org.springframework.boot:spring-boot-starter-websocket"
    compile "org.springframework.boot:spring-boot-configuration-processor"
    compile "org.springframework.boot:spring-boot-starter-cache"
    compile "com.hazelcast:hazelcast-spring:3.12"
    compile "com.hazelcast:hazelcast-eureka-one:1.0.2"
    compile "org.reflections:reflections:0.9.11"
    compile group: 'io.opentracing.contrib', name: 'opentracing-spring-cloud-mongo-starter', version: '0.3.12'


}    

如何解决这个问题?请帮助我,将不胜感激。 我想将我的应用升级到springboot v2.2.2。所以需要这个版本的解决方案。

【问题讨论】:

    标签: java spring-boot swagger swagger-2.0 spring-boot-actuator


    【解决方案1】:

    更新您的 springfox-swagger 版本。我用 boot 2.2.2 运行 springfox 2.9.2

    编辑 98.01.2020:

    你不知何故在你的类路径中得到了 spring-plugin-core-2.2.0.RELEASE。 SpringFox 需要 1.2.0 版本,Spring Boot 2.2.2 本身并没有拉入这个。你能运行 gradle dependencies --configuration runtimeClasspath 并检查哪个依赖拉入这个版本吗?

    【讨论】:

    • P.J.Meisch 感谢您的回复。我已经尝试过这个版本,但它还不能正常工作。
    • @P.J.Meisch 先生,请问您使用的是哪个 springCloudVersion?
    • 我没有使用 Spring Cloud。只是 Spring Boot 和一个手动添加的 springfox。
    • 先生仍然无法正常工作。你能分享你的代码吗?将不胜感激。
    • 你不知何故在你的类路径中得到了 spring-plugin-core-2.2.0.RELEASE。 SpringFox 需要 1.2.0 版本,Spring Boot 2.2.2 本身将其拉入。您可以运行gradle dependencies --configuration runtimeClasspath 并检查该版本中拉入的依赖项吗?
    猜你喜欢
    • 2020-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多