我正在尝试将我的 SpringBoot 版本从 2.0.x 升级到 2.3.8.RELEASE。更新后,在刷新 Spring Config Server 时,我的应用程序日志中出现 java.lang.NoClassDefFoundError:brave/internal/HexCodec。我的应用程序部署在 PCF 上,除了公司的内部依赖项外,还使用以下依赖项。
POM 文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<spring.cloud.vault.version>2.0.1.RELEASE</spring.cloud.vault.version>
<spring-cloud-config-client>2.1.4.RELEASE</spring-cloud-config-client>
<spring.cloud.services.version>2.0.3.RELEASE</spring.cloud.services.version>
<spring.cloud.dependencies.version>Hoxton.SR8</spring.cloud.dependencies.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-dependencies</artifactId>
<version>${spring.cloud.services.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud.dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-vault-dependencies</artifactId>
<version>${spring.cloud.vault.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.8.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.savoirtech.logging</groupId>
<artifactId>slf4j-json-logger</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-starter-config-client</artifactId>
<version>${spring-cloud-config-client}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
</project>
我认为我遇到这个问题是因为 Spring Sleuth 中使用了 Zipkins(我们在公司的内部依赖项中有这个)。我尝试设置 spring.zepkin.enabled=false 并且我还尝试使用 org.springframework.cloud:spring-cloud-starter-sleuth:2.2.8.RELEASE 创建下面的 bean,但我仍然遇到了同样的错误。
@Bean
Reporter<Span> reporter() {
return Reporter.NOOP;
}
应用程序控制台错误消息:org.springframework.web.util.NestedServletException: Handler dispatch failed;嵌套异常是 java.lang.NoClassDefFoundError:brave/internal/HexCodec
在这一点上,我什至不确定我是否走在正确的轨道上。如果需要更多信息,请告诉我。