当前位置: 首页 > 知识库问答 >
问题:

Spring sleuth错误-更正应用程序的类路径,使其包含类的兼容版本

艾鹭洋
2023-03-14

当我启动spring boot应用程序时,我遇到以下错误。

非常感谢您的帮助。

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

组织。springframework。云侦探。自动配置。TraceAutoConfiguration。sleuthCurrentTraceContextBuilder(TraceAutoConfiguration.java:205)

以下方法不存在:
'勇敢。传播CurrentTraceContext$生成器勇敢。传播线程LocalCurrentTraceContext。New Builder()'

调用方法的类org。springframework。云侦探。自动配置。TraceAutoConfiguration已从以下位置加载:

jar:文件:/usr/local/cillar/gradle/7.3.1/caches/modules-2/files-2.1/org。springframework。cloud/spring cloud sleuth core/2.2.2。发布/EFADBE4D0D8F3535723 BC638109098E691FADC91/spring-cloud-sleuth-core-2.2.2。释放。罐子/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration。班

被调用方法的类,勇敢。传播ThreadLocalCurrentTraceContext可从以下位置获得:

jar:文件:/usr/local/cillar/gradle/7.3.1/caches/modules-2/files-2.1/io。齐普金。brave/brave/5.13.2/8B44454A5712E0049D2E0D189D8102C53263DB240/brave-5.13.2。罐子/勇敢/传播/线程LocalCurrentTraceContext。班

被调用方法的类层次结构是从以下位置加载的:

勇敢的传播ThreadLocalCurrentTraceContext:文件:/usr/local/cillar/gradle/7.3.1/caches/modules-2/files-2.1/io。齐普金。brave/brave/5.13.2/8B44454A5712E0049D2E0D189D8102C53263DB240/brave-5.13.2。jar勇敢。传播CurrentTraceContext:文件:/usr/local/cillar/gradle/7.3.1/caches/modules-2/files-2.1/io。齐普金。brave/brave/5.13.2/8B44454A5712E0049D2E0D189D8102C53263html" target="_blank">DB240/brave-5.13.2。罐子

措施:

更正应用程序的类路径,使其包含类org的兼容版本。springframework。云侦探。自动配置。TraceAutoConfiguration和

brave.propagation.\n","@version":"1","logger_name":"org.springframework.boot.diagnostics.LoggingFailureAnalysis","thread_name":"main","level":"ERROR"}

我的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个答案

祖迪
2023-03-14

我可以看到您已经为sleuth dependency设置了一个版本:

org.springframework.cloud:spring-cloud-starter-sleuth:2.2.2。释放

请尝试删除此依赖项的版本,并让gradle解析与您正在使用的Spring Boot版本对应的兼容版本的侦探。

郑帅
2023-03-14

您正在使用2021的云BOM。为什么要手动设置sleuth版本?只需删除手动设置的版本,即可完成

 类似资料: