3
votes

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

1

1 Answers

1
votes

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!