原因:java.lang.NoSuchMethodError:“org.apache.Kafka.common.KafkaFuture org.apache.Kafka.clients.admin.DescribeTopicsResult.allTopicNames()”

ecbunoof  于 2023-10-15  发布在  Apache
关注(0)|答案(1)|浏览(385)

版本- Springboot - 3.1.1 Spring cloud - 2022.0.3
云依赖-实现(“org.springframework.cloud:spring-cloud-stream”)实现(“org.springframework.cloud:spring-cloud-starter-stream-Kafka”)
获取事件发布时出错-

Caused by: java.lang.NoSuchMethodError: 'org.apache.kafka.common.KafkaFuture org.apache.kafka.clients.admin.DescribeTopicsResult.allTopicNames()'
    at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.lambda$retrieveTopicDescriptions$1(KafkaTopicProvisioner.java:275) ~[spring-cloud-stream-binder-kafka-core-4.0.3.jar!/:4.0.3]
    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:329) ~[spring-retry-1.3.1.jar!/:na]
    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:209) ~[spring-retry-1.3.1.jar!/:na]
    at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.retrieveTopicDescriptions(KafkaTopicProvisioner.java:267) ~[spring-cloud-stream-binder-kafka-core-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.getPartitionsForTopic(KafkaTopicProvisioner.java:258) ~[spring-cloud-stream-binder-kafka-core-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.provisionProducerDestination(KafkaTopicProvisioner.java:194) ~[spring-cloud-stream-binder-kafka-core-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binder.kafka.provisioning.KafkaTopicProvisioner.provisionProducerDestination(KafkaTopicProvisioner.java:91) ~[spring-cloud-stream-binder-kafka-core-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:286) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:102) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binder.AbstractBinder.bindProducer(AbstractBinder.java:153) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binding.BindingService.doBindProducer(BindingService.java:345) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:294) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.function.StreamBridge.resolveDestination(StreamBridge.java:257) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:161) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:147) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:142) ~[spring-cloud-stream-4.0.3.jar!/:4.0.3]
    at com.alefeducation.contentrepositoryservice.event.Publisher.publish(Publisher.kt:17) ~[classes!/:0.0.1-SNAPSHOT]
    at com.alefeducation.contentrepositoryservice.services.RepositoryService.createRepository(RepositoryService.kt:21) ~[classes!/:0.0.1-SNAPSHOT]
    at com.alefeducation.contentrepositoryservice.controller.RepositoryController.createRepository(RepositoryController.kt:22) ~[classes!/:0.0.1-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]

版本似乎兼容,这是我使用的版本-enter image description here

9bfwbjaz

9bfwbjaz1#

您似乎正在使用Spring-Kafka 3.0.8,它依赖于Kafka 3.3.2。但是,您的依赖关系树显示您实际上使用Kafka 3.4.1运行它,这可能会导致问题。
https://mvnrepository.com/artifact/org.springframework.kafka/spring-kafka/3.0.8
这应该通过升级spring-kafka集成来解决。

相关问题