Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError: org.apache.kafka.common.metrics.Sensor.add error in kafka streams

I am getting the below exception when I try to create a kafka streams instance.
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.kafka.common.metrics.Sensor.add(Lorg/apache/kafka/common/MetricName;Lorg/apache/kafka/common/metrics/MeasurableStat;)Z at org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.<init>(StreamsMetricsImpl.java:64) at org.apache.kafka.streams.processor.internals.StreamThread$StreamsMetricsThreadImpl.<init>(StreamThread.java:525) at org.apache.kafka.streams.processor.internals.StreamThread.create(StreamThread.java:618) at org.apache.kafka.streams.KafkaStreams.<init>(KafkaStreams.java:706) at org.apache.kafka.streams.KafkaStreams.<init>(KafkaStreams.java:624) at org.apache.kafka.streams.KafkaStreams.<init>(KafkaStreams.java:534)

I am trying to run the WordCountDemo scala example in intellij but unable to do so. I have org.apache.kafka:kafka-streams-scala_2.11:2.1.0 and org.apache.kafka:kafka-clients:1.0.2 dependencies included in my project and see the jars imported.

like image 879
Ashwin Sastry Avatar asked Nov 26 '18 23:11

Ashwin Sastry


1 Answers

The answer was already found in the comments by @Matthias

You will need same client version org.apache.kafka:kafka-clients:2.1.0 that matches KafkaStreams version

This was confirmed to work for the asker.

like image 140
Dennis Jaheruddin Avatar answered Sep 27 '22 20:09

Dennis Jaheruddin