【发布时间】:2020-06-15 19:30:06
【问题描述】:
我正在使用 intellij idea 在 scala 中进行 spark 应用程序。 我不知道为什么我会遇到错误。
代码:
package batch
import java.lang.management.ManagementFactory
import org.apache.spark.{SparkConf, SparkContext}
object BatchJob {
def main(args: Array[String]): Unit = {
val conf = new SparkConf()
.setAppName("Lambda with Spark")
val sc = new SparkContext(conf)
val sourceFile = "file:///E:/Boxes/data.tsv"
val input = sc.textFile(sourceFile)
input.foreach(println)
}
}
错误:
**Exception in thread "main" org.apache.spark.SparkException: A master URL must be set in your configuration**
【问题讨论】:
-
注释掉 if 语句是否有效?
-
@TerryDactyl:它的抛出错误为:错误:(22, 31) not found: value conf val sc = new SparkContext(conf)
标签: scala apache-spark