likes
comments
collection
share

SpringBoot 集成 swagger 后出现: Failed to start bean ‘documentationPluginsBootstrappe

作者站长头像
站长
· 阅读数 57

SpringBoot 集成 swagger 后出现: Failed to start bean 'documentationPluginsBootstrapper'的解决方法

2020-11-20 18:52:26.864 WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.concat(Ljava/lang/Iterable;Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable;
2020-11-20 18:52:26.866 INFO  o.s.j.e.a.AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown
2020-11-20 18:52:26.867 INFO  o.s.j.e.a.AnnotationMBeanExporter - Unregistering JMX-exposed beans
2020-11-20 18:52:26.886 WARN  c.n.c.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2020-11-20 18:52:26.886 INFO  c.n.c.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-11-20 18:52:26.905 INFO  o.s.a.r.l.SimpleMessageListenerContainer - Shutdown ignored - container is not active already
2020-11-20 18:52:26.910 INFO  o.a.catalina.core.StandardService - Stopping service [Tomcat]
2020-11-20 18:52:26.927 WARN  o.a.c.loader.WebappClassLoaderBase - The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
 com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)

Process finished with exit code 1

根据以前解决错误的思路,往往都是看最后一个报错的日志,例如:

but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread

但是、我找了半天都没找到什么原因。还以为是我写的程序存在内存泄漏呢,就去用 JVM 相关的技术去排错,排了半天也没发现问题。

后来实在没办法了,就继续一步一步的往上翻看日志,找到了一句:

 Failed to start bean 'documentationPluginsBootstrapper' 
 nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.concat(Ljava/lang/Iterable;Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable;

去百度一搜,果然是这个的问题。

SpringBoot 集成 swagger 后出现: Failed to start bean ‘documentationPluginsBootstrappe

出现这个问题的原因就是:当前项目的guava版本与之不匹配

去查看了下项目里的 guava 的版本和 swagger 中的 guava 的版本:

SpringBoot 集成 swagger 后出现: Failed to start bean ‘documentationPluginsBootstrappe

果然是版本不同。

修改成和 swagger 相同的 guava 版本即可:

SpringBoot 集成 swagger 后出现: Failed to start bean ‘documentationPluginsBootstrappe

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>20.0</version>
    </dependency>

SpringBoot 集成 swagger 后出现: Failed to start bean ‘documentationPluginsBootstrappe

转载自:https://juejin.cn/post/6909365029670223885
评论
请登录