import org.apache.spark.streaming.twitter._
给出错误
对象twitter不是包org.apache.spark.streaming
的成员
我正在尝试使用Spark来传输Twitter数据。我正在使用SBT,并花了很多时间来解决这个问题。这就是我的SBT的样子:
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"
任何解决此问题的解决方案都将受到高度赞赏。
答案 0 :(得分:0)
缺少Twitter流媒体依赖性。将以下依赖项添加到您的项目中。
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>