使用spark-cassandra连接器运行spark app时出错

时间:2015-06-09 17:40:42

标签: cassandra apache-spark spark-cassandra-connector

我已经编写了一个基本的火花应用程序,可以按照本指南(https://github.com/datastax/spark-cassandra-connector/blob/master/doc/0_quick_start.md)读取和写入Cassandra

这就是这个应用程序的.sbt:

name := "test Project"

version := "1.0"

scalaVersion := "2.10.5"

libraryDependencies ++= Seq(
      "org.apache.spark" %% "spark-core" % "1.2.1",
      "com.google.guava" % "guava" % "14.0.1",
      "com.datastax.spark" %% "spark-cassandra-connector" % "1.2.1",
      "org.apache.cassandra" % "cassandra-thrift" % "2.0.14",
      "org.apache.cassandra" % "cassandra-clientutil" % "2.0.14",
      "com.datastax.cassandra" % "cassandra-driver-core"  % "2.0.14"
)

正如你所看到的那样,Spark版本是 1.2.1 (而不像许多其他问题那样是1.3.1)但是当我使用spark-submit运行这个应用时我仍然遇到错误:

WARN TaskSetManager: Lost task 1.0 in stage 0.0 (TID 1, abcdev26): java.lang.NoSuchMethodError: org.apache.spark.executor.TaskMetrics.inputMetrics_$eq(Lscala/Option;)V
        at com.datastax.spark.connector.metrics.InputMetricsUpdater$.apply(InputMetricsUpdater.scala:61)
        at com.datastax.spark.connector.rdd.CassandraTableScanRDD.compute(CassandraTableScanRDD.scala:196)
        at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277)
        at org.apache.spark.rdd.RDD.iterator(RDD.scala:244)
        at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61)
        at org.apache.spark.scheduler.Task.run(Task.scala:64)
        at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:203)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

我错过了什么? 到目前为止我搜索过的所有答案都建议使用我已经在做的1.2.1。

任何建议都会非常感谢!

1 个答案:

答案 0 :(得分:1)

您是否100%确定您正在运行Spark 1.2.1?还有执行者?

问题是此度量标准访问器在Spark 1.3.0中变为私有,因此无法在运行时找到。请参阅TaskMetrics.scala - Spark 1.2.2 vs TaskMetrics.scala - spark v1.3.0,因此很可能在某处有Spark1.3.x版本。

确保所有执行程序上都有相同的1.2.x版本。