Spring sleuth 错误 - 更正应用程序的类路径,使其包含类的兼容版本
当我启动我的 spring boot 应用程序时,我遇到了下面的错误。
非常感谢任何帮助。
尝试调用不存在的方法。尝试 是从以下位置制作的:
org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration.sleuthCurrentTraceContextBuilder(TraceAutoConfiguration.java:205)
以下方法不存在:
'brave.propagation.CurrentTraceContext$Builder Brave.propagation.ThreadLocalCurrentTraceContext.newBuilder()'调用方法的类, org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration, 从以下位置加载:
jar:文件:/usr/local/Cellar/gradle/7.3.1/caches/modules-2/files-2.1/org.springframework.cloud/spring-cloud-sleuth-core/2.2.2.RELEASE/ efadbe4d0d8f3 535723bc638109098e691fadc91/spring-cloud-sleuth-core-2.2.2.RELEASE.jar!/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.class被调用方法的类, Brave.propagation.ThreadLocalCurrentTraceContext,可从 以下地点:
jar:文件:/usr/local/Cellar/gradle/7.3.1/caches/modules-2/files-2.1/io.zipkin.brave/brave/5.13.2/8b44454a5 712e049d2e0d189d8102c53263db240/brave-5.13.2.jar!/brave/propagation/ThreadLocalCurrentTraceContext.class被调用方法的类层次结构是从以下位置加载的 地点:
brave.propagation.ThreadLocalCurrentTraceContext: 文件:/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: 文件:/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
行动:
更正应用程序的类路径,使其包含 类的兼容版本 org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration 和
brave.propagation.ThreadLocalCurrentTraceContext\n","@version":"1","logger_name":"org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter","thread_name":"main","level":"错误”}
我的 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'
}
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.jarAction:
Correct the classpath of your application so that it contains
compatible versions of the classes
org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration andbrave.propagation.ThreadLocalCurrentTraceContext\n","@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'
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用的是云 BOM 2021。为什么要手动设置 sleuth 版本?只需删除手动设置的版本即可
You're using the cloud BOM 2021. Why are you setting sleuth version manually? Just remove the manually set version and you're done
我可以看到您已经放置了 sleuth 依赖项的版本:
请尝试删除此依赖项的版本,并让 gradle 解析与您正在使用的 Spring Boot 版本相对应的 sleuth 的兼容版本。
I can see that you have put a version for sleuth dependency :
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.