Anonymous
Anonymous

Reputation: 193

Am getting error in scala programming while integrating spark streaming with kafka

Am trying to add some imports , but when I add import org.apache.spark.streaming.kafka.kafkautils its showing the below error

object kafka is not a member of the object org.apache.spark.streaming.kafka.kafkautils

working on eclipse with scala ide 4.7 version 2.11.11, spark-2.3.0-bin-hadoop2.7 jar files, kafka 2.11 jars, spark-streaming-kafka-0-10_2.11-2.3.0 jar

Upvotes: 3

Views: 536

Answers (1)

koiralo
koiralo

Reputation: 23109

If you are using spark-streaming-kafka-0-10_2.11-2.3.0 jar then the KafkaUtils is available in org.apache.spark.streaming.kafka010 this package. So import

import org.apache.spark.streaming.kafka010.KafkaUtils

and not

import org.apache.spark.streaming.kafka.kafkautils 

Hope this hepls!

Upvotes: 1

Related Questions