对象流不是包 org.apache.spark 的成员

G.S*_*leh 5 scala apache-spark

我正在尝试编译一个简单的 scala 程序,我正在使用 StreamingContext ,这是我的代码片段:

import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.scheduler.SparkListener
import org.apache.spark.scheduler.SparkListenerStageCompleted
import org.apache.spark.streaming.StreamingContext._ //error:object streaming is not a member of package org.apache.spark
object FileCount {
    def main(args: Array[String]) {
    val conf = new SparkConf()
    .setAppName("File Count")
    .setMaster("local")

    val sc = new SparkContext(conf)
    val textFile = sc.textFile(args(0))
    val ssc = new StreamingContext(sc, Seconds(10)) //error : not found: type StreamingContext
    sc.stop()    
  }
}
Run Code Online (Sandbox Code Playgroud)

我有这两个错误:

object streaming is not a member of package org.apache.spark
Run Code Online (Sandbox Code Playgroud)

not found: type StreamingContext
Run Code Online (Sandbox Code Playgroud)

任何帮助请!

eli*_*sah 3

您需要将 Spark-streaming 的依赖项添加到构建管理器中。