Spring-kafka with spring boot actuator 错误 - 原因:java.lang.ClassNotFoundException: org.springframework

Posted

技术标签:

【中文标题】Spring-kafka with spring boot actuator 错误 - 原因:java.lang.ClassNotFoundException: org.springframework.kafka.core.ProducerFactory$Listener【英文标题】:Spring-kafka with spring boot actuator error - Caused by: java.lang.ClassNotFoundException: org.springframework.kafka.core.ProducerFactory$Listener 【发布时间】:2021-03-03 23:08:21 【问题描述】:

这与我的 spring boot 应用程序在 spring-kafka 依赖项下正常工作有关。在我添加 spring-boot-starter-actuator 依赖项后,使用 prometheus 监视应用程序时,我的应用程序会因异常而崩溃。

如果我删除 spring-boot-starter-actuator 依赖应用程序工作正常。似乎 spring-kafka 与 spring-boot-starter-actuator 存在一些兼容性问题。 Actuator 无法收集/发布 Kafka 指标。请建议我如何使用执行器和普罗米修斯进行 springboot 应用程序监控

编辑 根据兼容性matrix 更新 spring-kafka 和 kafka-clients 依赖项后,我开始在 EmbeddedKafkaBroker 服务器启动的 junits 中遇到异常。 org.apache.kafka.common.security.JaasUtils.isZkSecurityEnabled() 方法似乎在 kafka-clients 中被删除/更新,该方法是从 sprint-kafka-test 的 EmbeddedKafkaBroker 类调用的。异常堆栈跟踪在下面更新。还提供了 mvn 依赖树。

如果根据 spring 建议的兼容性包含依赖项,那么 spring-kafka-test 和 kafka-clients 不同步的原因可能是什么。请建议解决此错误。

pom.xml(已编辑

<properties>
    <spring-boot.version>2.3.0.RELEASE</spring-boot.version>
    <spring.version>5.2.6.RELEASE</spring.version>
    <springkafka.version>2.5.1.RELEASE</springkafka.version>
    <kafkaclient.version>2.5.0</kafkaclient.version>
</properties>

<dependencies>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <version>$spring-boot.version</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>$spring.version</version>
  </dependency>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    <version>$spring-boot.version</version>
  </dependency>
  <dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
    <version>1.5.3</version>
  </dependency>
</dependencies>

异常堆栈跟踪(已编辑

[ERROR]:::[]:[]:[]:[]:[Fatal error during KafkaServer startup. Prepare to shutdown]
java.lang.NoSuchMethodError: org.apache.kafka.common.security.JaasUtils.isZkSecurityEnabled()Z
        at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:384)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:207)
        at kafka.utils.TestUtils$.createServer(TestUtils.scala:159)
        at kafka.utils.TestUtils$.createServer(TestUtils.scala:150)
        at kafka.utils.TestUtils.createServer(TestUtils.scala)
        at org.springframework.kafka.test.EmbeddedKafkaBroker.afterPropertiesSet(EmbeddedKafkaBroker.java:309)
        at org.springframework.kafka.test.rule.EmbeddedKafkaRule.before(EmbeddedKafkaRule.java:113)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

mvn 依赖:树

[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.3.0.RELEASE:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.2:compile
[INFO] |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.springframework:spring-core:jar:5.2.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.2.6.RELEASE:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.26:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-redis:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-redis:jar:2.3.0.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-keyvalue:jar:2.3.0.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-oxm:jar:5.2.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-aop:jar:5.2.6.RELEASE:compile
[INFO] |  \- io.lettuce:lettuce-core:jar:5.3.0.RELEASE:compile
[INFO] |     \- io.projectreactor:reactor-core:jar:3.3.5.RELEASE:compile
[INFO] |        \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.3:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-quartz:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:5.2.6.RELEASE:compile
[INFO] |  \- org.quartz-scheduler:quartz:jar:2.3.2:compile
[INFO] |     \- com.mchange:mchange-commons-java:jar:0.2.15:compile
[INFO] +- com.google.guava:guava:jar:19.0:compile
[INFO] +- io.netty:netty-handler-proxy:jar:4.1.46.Final:compile
[INFO] |  +- io.netty:netty-common:jar:4.1.46.Final:compile
[INFO] |  +- io.netty:netty-buffer:jar:4.1.46.Final:compile
[INFO] |  +- io.netty:netty-transport:jar:4.1.46.Final:compile
[INFO] |  +- io.netty:netty-codec:jar:4.1.46.Final:compile
[INFO] |  +- io.netty:netty-codec-socks:jar:4.1.46.Final:compile
[INFO] |  \- io.netty:netty-codec-http:jar:4.1.46.Final:compile
[INFO] +- io.netty:netty-codec-http2:jar:4.1.46.Final:compile
[INFO] |  \- io.netty:netty-handler:jar:4.1.46.Final:compile
[INFO] +- com.bmc.aif:aif-core-grpc-library:jar:1.0.00-SNAPSHOT:compile
[INFO] |  +- io.grpc:grpc-netty:jar:1.6.1:compile
[INFO] |  +- io.grpc:grpc-core:jar:1.6.1:compile
[INFO] |  +- io.grpc:grpc-context:jar:1.6.1:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.0.19:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] |  +- com.google.instrumentation:instrumentation-api:jar:0.4.3:compile
[INFO] |  +- io.opencensus:opencensus-api:jar:0.5.1:compile
[INFO] |  +- io.netty:netty-resolver:jar:4.1.46.Final:compile
[INFO] |  +- io.grpc:grpc-protobuf:jar:1.6.1:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.3.1:compile
[INFO] |  +- com.google.protobuf:protobuf-java-util:jar:3.3.1:compile
[INFO] |  +- com.google.api.grpc:proto-google-common-protos:jar:0.1.9:compile
[INFO] |  |  \- com.google.api:api-common:jar:1.0.0-rc1:compile
[INFO] |  |     \- com.google.auto.value:auto-value:jar:1.1:compile
[INFO] |  +- io.grpc:grpc-protobuf-lite:jar:1.6.1:compile
[INFO] |  |  \- com.google.protobuf:protobuf-lite:jar:3.0.1:compile
[INFO] |  +- io.grpc:grpc-stub:jar:1.6.1:compile
[INFO] |  \- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] +- com.bmc.aif:kafka-messaging-library:jar:1.0.00-SNAPSHOT:compile
[INFO] |  +- org.eclipse.collections:eclipse-collections:jar:10.2.0:compile
[INFO] |  \- org.eclipse.collections:eclipse-collections-api:jar:10.2.0:compile
[INFO] +- com.bmc.aif:aif-job-manager-grpc-library:jar:1.0.00-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.3.0.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.3.0.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.3.0.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.16.1:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.6.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.6.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.6.2:test
[INFO] |  +- org.junit.vintage:junit-vintage-engine:jar:5.6.2:test
[INFO] |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  |  +- org.junit.platform:junit-platform-engine:jar:1.6.2:test
[INFO] |  |  \- junit:junit:jar:4.13:test
[INFO] |  +- org.mockito:mockito-core:jar:3.3.3:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.10.5:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:3.3.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:5.2.6.RELEASE:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.7.0:test
[INFO] +- org.projectlombok:lombok:jar:1.16.22:provided
[INFO] +- com.h2database:h2:jar:1.4.200:test
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.0:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.0:runtime
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.11.0:compile
[INFO] +- org.springframework:spring-tx:jar:5.2.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-beans:jar:5.2.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jdbc:jar:2.3.0.RELEASE:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.3.0.RELEASE:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:3.4.5:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:5.2.6.RELEASE:compile
[INFO] |  \- org.springframework.data:spring-data-jdbc:jar:2.0.0.RELEASE:runtime
[INFO] |     +- org.springframework.data:spring-data-relational:jar:2.0.0.RELEASE:runtime
[INFO] |     \- org.springframework.data:spring-data-commons:jar:2.3.0.RELEASE:compile
[INFO] +- org.postgresql:postgresql:jar:42.2.14:runtime
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.6:runtime
[INFO] +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.10.9:runtime
[INFO] +- com.github.everit-org.json-schema:org.everit.json.schema:jar:1.12.1:compile
[INFO] |  +- commons-validator:commons-validator:jar:1.6:compile
[INFO] |  |  +- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] |  |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  +- com.damnhandy:handy-uri-templates:jar:2.1.8:compile
[INFO] |  |  \- joda-time:joda-time:jar:2.10.2:compile
[INFO] |  \- com.google.re2j:re2j:jar:1.3:compile
[INFO] +- com.bmc.truesight.saas:tspod-library:jar:1.0.00-SNAPSHOT:compile
[INFO] +- com.bmc.ade.core:service-pre-deployment-library:jar:1.0.00-SNAPSHOT:runtime
[INFO] |  +- com.bmc.truesight.saas.thirdparty:jackson-databind:jar:2.10.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:jopt-simple:jar:5.0.3:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:zkclient:jar:0.10:compile
[INFO] |  +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] |  +- org.apache.zookeeper:zookeeper-jute:jar:3.5.6:compile
[INFO] |  |  \- org.apache.yetus:audience-annotations:jar:0.5.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:jackson-dataformat-yaml:jar:2.10.0:compile
[INFO] |  +- org.scala-lang:scala-library:jar:2.12.10:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:curator-recipes:jar:2.9.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:curator-framework:jar:2.9.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:curator-client:jar:2.9.0:compile
[INFO] |  +- org.apache.kafka:kafka_2.12:jar:2.4.1:compile
[INFO] |  |  +- com.fasterxml.jackson.module:jackson-module-scala_2.12:jar:2.10.0:compile
[INFO] |  |  |  \- com.fasterxml.jackson.module:jackson-module-paranamer:jar:2.10.0:compile
[INFO] |  |  |     \- com.thoughtworks.paranamer:paranamer:jar:2.8:compile
[INFO] |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.10.0:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.0:compile
[INFO] |  |  +- net.sf.jopt-simple:jopt-simple:jar:5.0.4:compile
[INFO] |  |  +- org.scala-lang.modules:scala-collection-compat_2.12:jar:2.1.2:compile
[INFO] |  |  +- org.scala-lang.modules:scala-java8-compat_2.12:jar:0.9.0:compile
[INFO] |  |  +- com.typesafe.scala-logging:scala-logging_2.12:jar:3.9.2:compile
[INFO] |  |  \- commons-cli:commons-cli:jar:1.4:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:zookeeper:jar:3.5.6:compile
[INFO] |  +- org.apache.kafka:kafka-streams:jar:2.4.1:runtime
[INFO] |  |  +- org.apache.kafka:connect-json:jar:2.4.1:runtime
[INFO] |  |  |  \- org.apache.kafka:connect-api:jar:2.4.1:runtime
[INFO] |  |  \- org.rocksdb:rocksdbjni:jar:5.18.3:runtime
[INFO] |  +- com.bmc.truesight.saas.thirdparty:metrics-core:jar:3.2.4:runtime
[INFO] |  +- org.scala-lang:scala-reflect:jar:2.12.10:compile
[INFO] |  \- com.bmc.truesight.saas.thirdparty:scala-logging_2.12:jar:3.9.0:runtime
[INFO] +- com.bmc.truesight.saas:tspod-library-implv2:jar:1.0.00-SNAPSHOT:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:slf4j-api:jar:1.7.25:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:logback-classic:jar:1.2.3:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:logback-core:jar:1.2.3:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-codec-http2:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-common:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-buffer:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-codec:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-codec-http:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-codec-socks:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-handler:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-handler-proxy:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-resolver:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-transport:jar:4.1.46.Final:compile
[INFO] |  +- org.apache.zookeeper:zookeeper:jar:3.5.6:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-transport-native-epoll:jar:4.1.46.Final:compile
[INFO] |  |  \- io.netty:netty-transport-native-unix-common:jar:4.1.46.Final:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:netty-transport-native-unix-common:jar:4.1.46.Final:compile
[INFO] |  +- org.apache.logging.log4j:log4j-1.2-api:jar:2.13.0:compile
[INFO] |  |  \- org.apache.logging.log4j:log4j-api:jar:2.13.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:curator-x-discovery:jar:2.9.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:grpc-core:jar:1.6.1:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:jackson-mapper-asl:jar:1.9.13.redhat-2:compile
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:jackson-core:jar:2.10.0:compile
[INFO] |  +- com.bmc.truesight.saas.thirdparty:jackson-annotations:jar:2.10.0:compile
[INFO] |  +- com.bmc.truesight.saas:tspod-commu-service-grpc-library:jar:1.0.00-SNAPSHOT:compile
[INFO] |  \- com.bmc.truesight.saas:pre-deployment-library:jar:1.0.00-SNAPSHOT:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:cassandra-driver-core:jar:3.8.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:guava:jar:19.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:elasticsearch:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch:elasticsearch-core:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch:elasticsearch-secure-sm:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch:elasticsearch-x-content:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch:elasticsearch-geo:jar:7.7.0:compile
[INFO] |     |  +- org.apache.lucene:lucene-core:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-analyzers-common:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-backward-codecs:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-grouping:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-highlighter:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-join:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-memory:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-misc:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-queries:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-queryparser:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-sandbox:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-spatial-extras:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-spatial3d:jar:8.5.1:compile
[INFO] |     |  +- org.apache.lucene:lucene-suggest:jar:8.5.1:compile
[INFO] |     |  +- org.elasticsearch:elasticsearch-cli:jar:7.7.0:compile
[INFO] |     |  +- com.carrotsearch:hppc:jar:0.8.1:compile
[INFO] |     |  +- com.tdunning:t-digest:jar:3.2:compile
[INFO] |     |  \- org.elasticsearch:jna:jar:4.5.1:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:elasticsearch-core:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:elasticsearch-x-content:jar:7.7.0:compile
[INFO] |     |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.10.4:compile
[INFO] |     |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.10.4:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:transport:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch:elasticsearch:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch.plugin:transport-netty4-client:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch.plugin:reindex-client:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch.plugin:lang-mustache-client:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch.plugin:percolator-client:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch.plugin:parent-join-client:jar:7.7.0:compile
[INFO] |     |  \- org.elasticsearch.plugin:rank-eval-client:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:transport-netty4-client:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:reindex-client:jar:7.7.0:compile
[INFO] |     |  \- org.elasticsearch:elasticsearch-ssl-config:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:parent-join-client:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lang-mustache-client:jar:7.7.0:compile
[INFO] |     |  \- com.github.spullara.mustache.java:compiler:jar:0.9.6:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:percolator-client:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:elasticsearch-rest-high-level-client:jar:7.7.0:compile
[INFO] |     |  +- org.elasticsearch.plugin:mapper-extras-client:jar:7.7.0:compile
[INFO] |     |  \- org.elasticsearch.plugin:aggs-matrix-stats-client:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:rank-eval-client:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-core:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-analyzers-common:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-backward-codecs:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-grouping:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-highlighter:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-join:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-memory:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-misc:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-queries:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-queryparser:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-sandbox:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-spatial:jar:8.4.1:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-spatial-extras:jar:8.5.2:compile
[INFO] |     |  +- io.sgr:s2-geometry-library-java:jar:1.0.0:compile
[INFO] |     |  \- org.locationtech.spatial4j:spatial4j:jar:0.7:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:lucene-suggest:jar:8.5.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:httpclient:jar:4.5.7:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:httpcore:jar:4.4.11:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:httpcore-nio:jar:4.4.11:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:httpasyncclient:jar:4.1.4:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:commons-codec:jar:1.11:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:commons-logging:jar:1.1.3:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:netty-all:jar:4.1.46.Final:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:compiler:jar:0.9.3:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:jcl-over-slf4j:jar:1.7.25:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:log4j-core:jar:2.12.1:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:log4j-api:jar:2.12.1:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:jackson-dataformat-cbor:jar:2.10.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:scala-parser-combinators_2.12:jar:1.1.1:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:scala-library:jar:2.12.6:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:cassandra-driver-mapping:jar:3.8.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:joda-time:jar:2.10.2:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:elasticsearch-cli:jar:7.7.0:compile
[INFO] |     +- com.bmc.truesight.saas.thirdparty:t-digest:jar:3.2:compile
[INFO] |     \- com.bmc.truesight.saas.thirdparty:hppc:jar:0.8.1:compile
[INFO] +- commons-io:commons-io:jar:2.7:compile
[INFO] +- com.bmc.truesight.saas:env-provider-library:jar:1.0.00-SNAPSHOT:compile
[INFO] +- com.bmc.truesight.saas:env-provider-library-impl:jar:1.0.00-SNAPSHOT:compile
[INFO] +- org.json:json:jar:20200518:compile
[INFO] +- io.kubernetes:client-java:jar:8.0.0:compile
[INFO] |  +- io.kubernetes:client-java-api:jar:8.0.0:compile
[INFO] |  |  +- io.sundr:builder-annotations:jar:0.21.0:compile
[INFO] |  |  |  +- io.sundr:sundr-core:jar:0.21.0:compile
[INFO] |  |  |  +- io.sundr:sundr-codegen:jar:0.21.0:compile
[INFO] |  |  |  \- io.sundr:resourcecify-annotations:jar:0.21.0:compile
[INFO] |  |  +- io.swagger:swagger-annotations:jar:1.5.22:compile
[INFO] |  |  +- com.squareup.okhttp3:okhttp:jar:3.14.3:compile
[INFO] |  |  |  \- com.squareup.okio:okio:jar:1.17.2:compile
[INFO] |  |  +- com.squareup.okhttp3:logging-interceptor:jar:3.14.3:compile
[INFO] |  |  +- io.gsonfire:gson-fire:jar:1.8.3:compile
[INFO] |  |  \- org.joda:joda-convert:jar:1.2:compile
[INFO] |  +- io.kubernetes:client-java-proto:jar:8.0.0:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.11:compile
[INFO] |  +- org.apache.commons:commons-compress:jar:1.19:compile
[INFO] |  +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] |  \- org.bitbucket.b_c:jose4j:jar:0.7.0:compile
[INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.66:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.3.0.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.5:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.4.15.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.24.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.1.3.Final:compile
[INFO] |  |  +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  |  +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
[INFO] |  |  \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.1:compile
[INFO] |  |     +- org.glassfish.jaxb:txw2:jar:2.3.1:compile
[INFO] |  |     +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] |  |     +- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] |  |     \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.3.0.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:5.2.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.2.6.RELEASE:compile
[INFO] +- org.apache.kafka:kafka-clients:jar:2.5.0:compile
[INFO] |  +- com.github.luben:zstd-jni:jar:1.4.4-7:compile
[INFO] |  +- org.lz4:lz4-java:jar:1.7.1:compile
[INFO] |  \- org.xerial.snappy:snappy-java:jar:1.1.7.3:compile
[INFO] +- **org.springframework.kafka:spring-kafka-test:jar:2.5.1.RELEASE:test**
[INFO] |  +- org.springframework:spring-context:jar:5.2.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:5.2.6.RELEASE:compile
[INFO] |  +- org.springframework.retry:spring-retry:jar:1.2.5.RELEASE:compile
[INFO] |  +- **org.apache.kafka:kafka-clients:jar:test:2.5.0:test**
[INFO] |  +- org.apache.kafka:kafka-streams-test-utils:jar:2.5.0:test
[INFO] |  +- org.apache.kafka:kafka_2.12:jar:test:2.5.0:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-api:jar:5.6.2:test
[INFO] |     +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |     \- org.junit.platform:junit-platform-commons:jar:1.6.2:test
[INFO] +- **org.springframework.kafka:spring-kafka:jar:2.5.1.RELEASE:compile**
[INFO] |  \- org.springframework:spring-messaging:jar:5.2.6.RELEASE:compile
[INFO] +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] +- org.flywaydb:flyway-core:jar:6.5.0:compile
[INFO] +- com.bmc.ade:ims-java-sdk:jar:0.0.7:compile
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.7.21:compile
[INFO] |  |  \- log4j:log4j:jar:1.2.17:compile
[INFO] |  +- com.auth0:java-jwt:jar:3.3.0:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5.5:compile
[INFO] |     \- org.apache.httpcomponents:httpcore:jar:4.4.9:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.3.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.3.0.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:2.3.0.RELEASE:compile
[INFO] |  \- io.micrometer:micrometer-core:jar:1.5.1:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] \- io.micrometer:micrometer-registry-prometheus:jar:1.5.3:compile
[INFO]    \- io.prometheus:simpleclient_common:jar:0.8.1:compile
[INFO]       \- io.prometheus:simpleclient:jar:0.8.1:compile

【问题讨论】:

spring-boot-starter-actuator 中排除任何自动配置,如果这看起来非常关键,请手动配置您想要的内容 Kafka 2.4 与 Boot 2.3 不兼容;看我的回答。 按照@GaryRussell 和 DRoppelt 的建议更新了依赖项,但开始出现问题 wrt 兼容性 b/w spring-kafka-test 和 kafka-clients。更新了我的问题中的详细信息。请提出建议。 您的 Kafka 服务器 jar 与 org.apache.kafka:kafka_2.12:jar:2.4.1:compilecom.bmc.ade.core:service-pre-deployment-library 不匹配。您应该升级到 Boot 2.3.6 并从 Boot 托管依赖项中删除任何版本。但是,请参阅this issue,这是由于 Boot 规定的 Jackson 版本(自 2.3.5 起)引入了错误的 Scala 版本 - 不幸的是,Scala 人员在补丁版本中进行了严重的破坏性 API 更改,需要几个 jar被覆盖。 Here 是完整的说明,如果你想明确声明 spring-kafka 和 kafka 本身的版本。需要许多依赖项。或者您可以从其他部门中排除 Kafka。 【参考方案1】:

Spring Boot 2.3(当前为 2.3.6)需要 spring-kafka 2.5(当前为 2.5.8)。

一般情况下,您不应该为 Boot 依赖项指定版本; boot 将正确引入其兼容版本。

【讨论】:

【参考方案2】:

添加到 Gary 的评论中,如果您仍想自己管理依赖项,可以查阅此处的兼容性矩阵:https://spring.io/projects/spring-kafka

spring-kafka 2.5.X + Kafka 客户端 2.5.0 + Spring Boot 2.3.X

在你的情况下,我假设 spring-boot 领先,你需要升级 kafka-client + spring-kafka。

【讨论】:

以上是关于Spring-kafka with spring boot actuator 错误 - 原因:java.lang.ClassNotFoundException: org.springframework的主要内容,如果未能解决你的问题,请参考以下文章

spring-kafka 监听器签名

spring-kafka 固定事件迁移实现

LocalDateTime 的自定义 spring-kafka 反序列化器

Spring生态研习:Spring-kafka

Spring-Kafka.RecordIntercepter类未找到。找不到RecordIntercepter类

如何使用 testcontainers 和 spring-kafka 准备测试