skip to Main Content

When I start my spring boot application, I am running into this error below.

Any help is highly appreciated.

An attempt was made to call a method that does not exist. The attempt
was made from the following location:

org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration.sleuthCurrentTraceContextBuilder(TraceAutoConfiguration.java:205)

The following method did not exist:
‘brave.propagation.CurrentTraceContext$Builder
brave.propagation.ThreadLocalCurrentTraceContext.newBuilder()’

The calling method’s class,
org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration,
was loaded from the following location:

jar:file:/usr/local/Cellar/gradle/7.3.1/caches/modules-2/files-2.1/org.springframework.cloud/spring-cloud-sleuth-core/2.2.2.RELEASE/efadbe4d0d8f3535723bc638109098e691fadc91/spring-cloud-sleuth-core-2.2.2.RELEASE.jar!/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.class

The called method’s class,
brave.propagation.ThreadLocalCurrentTraceContext, is available from
the following locations:

jar:file:/usr/local/Cellar/gradle/7.3.1/caches/modules-2/files-2.1/io.zipkin.brave/brave/5.13.2/8b44454a5712e049d2e0d189d8102c53263db240/brave-5.13.2.jar!/brave/propagation/ThreadLocalCurrentTraceContext.class

The called method’s class hierarchy was loaded from the following
locations:

brave.propagation.ThreadLocalCurrentTraceContext:
file:/usr/local/Cellar/gradle/7.3.1/caches/modules-2/files-2.1/io.zipkin.brave/brave/5.13.2/8b44454a5712e049d2e0d189d8102c53263db240/brave-5.13.2.jar
brave.propagation.CurrentTraceContext:
file:/usr/local/Cellar/gradle/7.3.1/caches/modules-2/files-2.1/io.zipkin.brave/brave/5.13.2/8b44454a5712e049d2e0d189d8102c53263db240/brave-5.13.2.jar

Action:

Correct the classpath of your application so that it contains
compatible versions of the classes
org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration and

brave.propagation.ThreadLocalCurrentTraceContextn","@version":"1","logger_name":"org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter","thread_name":"main","level":"ERROR"}

My build.gradle

    id 'org.springframework.boot' version '2.6.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id 'project-report'
}

group = 'com.abc.xyz.eds'
version = '0.17.0-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
    mavenLocal()
    maven {
        url "https://wells.jfrog.io/wells/wells-maven"
        name "wells-central"
        credentials {
            
        }
  }
    maven {
        name 'wells-snapshots'
        url 'https://wells.jfrog.io/wells/wells-snapshots'
         credentials {
            
        }
        mavenContent {
            snapshotsOnly()
        }
    }
    maven {
        name 'wells-releases'
        url 'https://wells.jfrog.io/wells/wells-releases'
        credentials {
            
        }
        mavenContent {
            releasesOnly()
        }
    }
}

dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2021.0.0'
    }
    applyMavenExclusions = false
}


dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-cache'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation ('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    implementation 'redis.clients:jedis:2.9.0'
    implementation 'org.postgresql:postgresql'
    implementation 'ca.uhn.hapi.fhir:hapi-fhir-structures-r4:5.4.2'
    implementation 'com.fasterxml.jackson.core:jackson-core'
    implementation 'com.fasterxml.jackson.core:jackson-databind'
    implementation 'com.fasterxml.jackson.core:jackson-annotations'
    implementation 'org.springframework.boot:spring-boot-configuration-processor'
    implementation 'org.springframework.boot:spring-boot-test-autoconfigure'
    implementation 'org.springdoc:springdoc-openapi-ui:1.5.12'
    implementation 'org.springframework.cloud:spring-cloud-starter-sleuth:2.2.2.RELEASE'
    implementation 'ch.qos.logback:logback-classic'
    implementation 'net.logstash.logback:logstash-logback-encoder:6.6'
    implementation 'org.projectlombok:lombok:1.18.22'
    implementation ('com.wells.magnify.jiraboard:support-client:3.11.0-SNAPSHOT'){
        exclude group: 'com.wells.platform', module: 'tenant-contract'
    }

    annotationProcessor 'org.projectlombok:lombok:1.18.22'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
    implementation ('com.wells.magnify.eds:eds-common-authorization:1.0.2'){
        exclude group: 'com.wells.rapid.commonlibs', module: 'organization-keys'
    }
    implementation 'com.wells.rapid.commonlibs:rapid-key-interface:1.0.0'
    
    testImplementation 'com.h2database:h2'
    implementation 'com.wells.magnify.eds:eds-common-code:1.4.0-SNAPSHOT'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-params:5.2.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
    implementation 'com.amazonaws:aws-java-sdk-bom:1.11.490'
    implementation 'org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR3'
    
    testImplementation 'org.mockito:mockito-junit-jupiter:2.23.0'
    testImplementation 'org.mockito:mockito-core:2.21.0'
    testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.3.2'
  testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.2.0' 

}

bootRun {
    String activeProfile =  System.properties['spring.profiles.active']
    systemProperty "spring.profiles.active", activeProfile
}

springBoot  {
    buildInfo()
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

test {
    useJUnitPlatform()
    testLogging.showStandardStreams = true

    testLogging{
        events "passed", "skipped", "failed"
    }
    maxHeapSize = '1G'
}

2

Answers


  1. You’re using the cloud BOM 2021. Why are you setting sleuth version manually? Just remove the manually set version and you’re done

    Login or Signup to reply.
  2. I can see that you have put a version for sleuth dependency :

    ‘org.springframework.cloud:spring-cloud-starter-sleuth:2.2.2.RELEASE’

    Please try by removing the version for this dependency and let gradle resolve the compatible version of sleuth corresponding to the Spring Boot version you are using.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search