Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Caused by: java.lang.NoSuchMethodError: 'org.apache.kafka.common.KafkaFuture org.apache.kafka.clients.admin.DescribeTopicsResult.allTopicNames()'

Ask Question Spring cloud - 2022.0.3

Cloud dependencies - implementation("org.springframework.cloud:spring-cloud-stream") implementation("org.springframework.cloud:spring-cloud-starter-stream-kafka")

Getting error on event publish -

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]

Version seems compatible, here's the versions I am using - enter image description here

You seem to be using Spring-Kafka 3.0.8, which depends on Kafka 3.3.2. However, your dependency tree shows that you actually run it with Kafka 3.4.1, which may cause the problems.

https://mvnrepository.com/artifact/org.springframework.kafka/spring-kafka/3.0.8

This should be fixed by upgrading your spring-kafka integration.

tried this, didn't helped. Tried lowe version of spring boot 3.0.9 with cloud 2022.0.4 as suggested here - github.com/spring-cloud/spring-cloud-stream/issues/2784 Still the same issue. – Nabeel Ahmed Aug 8, 2023 at 10:13

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.