0
import org.apache.spark.streaming.twitter._

gives the error

object twitter is not a member of package org.apache.spark.streaming

I am trying to stream Twitter data using Spark. I am using SBT and have spent a lot of time to fix this. This is how my SBT looks like:

name := "stream-demo"
version := "1.0"
scalaVersion := "2.11.7"
val sparkVersion = "2.1.0"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-streaming" % sparkVersion)
libraryDependencies += "com.typesafe" % "config" % "1.3.0"
libraryDependencies += "org.twitter4j" % "twitter4j-core" % "4.0.4"
libraryDependencies += "org.twitter4j" % "twitter4j-stream" % "4.0.4"
"1.5.2"   

Any solution to fix this problem will be highly appreciated.

The Archetypal Paul
  • 41,321
  • 20
  • 104
  • 134
Anirban Das
  • 61
  • 1
  • 3

1 Answers1

0

Twitter streaming dependency is missing. Add below dependency to your project.

SBT:

org.apache.spark" %% "spark-streaming-twitter_2.10" % 1.6.3

Maven:

 <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-twitter_2.10 -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-streaming-twitter_2.10</artifactId>
            <version>1.6.3</version>
        </dependency>
Rahul Sharma
  • 5,614
  • 10
  • 57
  • 91