当前位置: 代码迷 >> 综合 >> java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.concat
  详细解决方案

java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.concat

热度:43   发布时间:2024-02-04 13:40:21.0

springboot打war包部署到tomcat出现:

 org.apache.catalina.LifecycleException: Failed to start component [StandardServer[7005]]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)at org.apache.catalina.startup.Catalina.start(Catalina.java:688)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during startat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)... 11 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]at java.util.concurrent.FutureTask.report(FutureTask.java:122)at java.util.concurrent.FutureTask.get(FutureTask.java:192)at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)... 13 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: A child container failed during startat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)... 6 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]at java.util.concurrent.FutureTask.report(FutureTask.java:122)at java.util.concurrent.FutureTask.get(FutureTask.java:192)at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)... 8 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)... 6 more
Caused by: 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;at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:184)at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:157)at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:121)at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:885)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:155)at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:135)at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5272)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)... 6 more
Caused by: 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;at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2205)at com.google.common.cache.LocalCache.get(LocalCache.java:3953)at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3957)at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4875)at springfox.documentation.schema.CachingModelDependencyProvider.dependentModels(CachingModelDependencyProvider.java:58)at springfox.documentation.schema.DefaultModelProvider.dependencies(DefaultModelProvider.java:128)at springfox.documentation.schema.CachingModelProvider.dependencies(CachingModelProvider.java:68)at springfox.documentation.spring.web.scanners.ApiModelReader.populateDependencies(ApiModelReader.java:136)at springfox.documentation.spring.web.scanners.ApiModelReader.read(ApiModelReader.java:78)at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:133)at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:71)at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:101)at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:167)at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)... 23 more
Caused by: java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.concat(Ljava/lang/Iterable;Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable;at springfox.documentation.schema.DefaultModelDependencyProvider.dependentModels(DefaultModelDependencyProvider.java:79)at springfox.documentation.schema.CachingModelDependencyProvider$1.load(CachingModelDependencyProvider.java:50)at springfox.documentation.schema.CachingModelDependencyProvider$1.load(CachingModelDependencyProvider.java:48)at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3542)at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2323)at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2286)at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)

解决方式,应用高版本的guava版本。本案例中swagger引入了低版本guava

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

在swagger中移除,clean工程重新打war

		<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><exclusions><exclusion><groupId>com.google.guava</groupId><artifactId>guava</artifactId></exclusion></exclusions><version>2.9.2</version></dependency>

 

  相关解决方案