question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring boot project failing with NoSuchMethodError

See original GitHub issue

Please take the time to search the repository, if your question has already been asked or answered.

  • What version of the library are you using? 2.9.2 What kind of issue is this?

  • Bug report.

I’ve added class with the following contents to Spring Boot (version 1.5.10) project:

@Configuration
@EnableSwagger2
public class SwaggerConfig {                                    
    @Bean
    public Docket api() { 
        return new Docket(DocumentationType.SWAGGER_2)  
          .select()                                  
          .apis(RequestHandlerSelectors.any())              
          .paths(PathSelectors.any())                          
          .build();                                           
    }
}

Now build is failing with the following error message

com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: springfox.documentation.spi.service.contexts.OperationContext.getHandlerMethod()Lorg/springframework/web/method/HandlerMethod;
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache.get(LocalCache.java:3948) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3972) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4957) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4963) ~[guava-25.0-jre.jar:na]
        at springfox.documentation.spring.web.scanners.CachingOperationReader.read(CachingOperationReader.java:57) ~[springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.scanners.ApiDescriptionReader.read(ApiDescriptionReader.java:70) ~[springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:134) [springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:71) [springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:101) [springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:167) [springfox-spring-web-2.9.1.jar:null]
        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
        at tech.osp.atm.chancellor.deployment.DeploymentApp.main(DeploymentApp.java:32) [main/:na]
Caused by: java.lang.NoSuchMethodError: springfox.documentation.spi.service.contexts.OperationContext.getHandlerMethod()Lorg/springframework/web/method/HandlerMethod;
        at com.lastmile.shared.jarjar.autoconfigure.aws.dynamodb.swagger.SwaggerDynamoDbCursorPlugin.apply(SwaggerDynamoDbCursorPlugin.java:31) ~[jar-jar-autoconfigure-4.18.11.jar:4.18.11]
        at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.operation(DocumentationPluginsManager.java:120) ~[springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.readers.operation.ApiOperationReader.read(ApiOperationReader.java:73) ~[springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:50) ~[springfox-spring-web-2.9.1.jar:null]
        at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:48) ~[springfox-spring-web-2.9.1.jar:null]
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2156) ~[guava-25.0-jre.jar:na]
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2046) ~[guava-25.0-jre.jar:na]
        ... 25 common frames omitted

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dilipkrishcommented, Sep 1, 2018

@ror6ax you’re using a version of guava that isnt supported by this library. I belive that version used to be 22.0. In anycase, this is fixed in the next version as there is no longer a dependency on guava

1reaction
ror6axcommented, Sep 1, 2018

@dilipkrish - thanks a lot, it was a really cryptic message to run into. By “next version”, you mean 2.9.3 release of Springfox? If so, can you tell when is it going to be released, approximately?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed spring boot app with java.lang.NoSuchMethodError
facing NoSuchMethodError, when I run my spring boot(v2.6.7) multi-module maven project, where I am interacting through feign client to other ...
Read more >
NoSuchMethodError in Java - Baeldung
As the name suggests, the NoSuchMethodError occurs when a particular method is not found. This method can either be an instance method or...
Read more >
How to Fix java.lang.NoSuchMethodError in Java - Rollbar
NoSuchMethodError occurs when an application does not find a called method at runtime. Some of the most common causes for a java.lang.
Read more >
3 Steps to Fix NoSuchMethodErrors and ...
The potential root cause for a NoSuchMethodError is that one of the libraries we use in our project had a breaking change from...
Read more >
Spring Boot 2.6.6 available now
reportFailure - Application run failed ... RELEASE to 2.6.6, after the upgrade maven builds are failing with following error. java.lang.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found