1
votes

When I submit the spark application, getting the below error:

Exception in thread "streaming-start" java.lang.NoSuchMethodError:

org.apache.kafka.clients.consumer.KafkaConsumer.subscribe(Ljava/util/Collection;)V

Went through the below URL: http://apache-spark-developers-list.1001551.n3.nabble.com/testing-the-kafka-0-10-connector-td17956.html

Set the below environment variable: SPARK_KAFKA_VERSION=0.10

Added the below dependency:

<dependency>
  <groupId>org.apache.spark</groupId>
  <artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
  <version>2.1.0.cloudera1</version>
</dependency>

Added the below jar: spark-streaming-kafka-0-10-assembly_2.11.jar

Versions I'm using:

  • Spark-2.0.2
  • Scala-2.11
  • Kafka-0.10

A piece of code:

val CLASS_NAME = this.getClass
val log = org.apache.log4j.LogManager.getLogger(CLASS_NAME)

Your help is highly appreciated.

1

1 Answers

3
votes

Try seting this:

export SPARK_KAFKA_VERSION=0.10