【发布时间】:2016-05-19 01:50:30
【问题描述】:
我正在尝试使用以下步骤通过 spark-1.6.0 和 scala-2.11.7 从 Cassandra 2.0.17 表中获取值
- 已启动 cassandra -- service cassandra start
- 启动 spark--sbin/start-all.sh
- 声明 spark scala -- bin/spark-shell --jars spark-cassandra-connector_2.10-1.5.0-M1.jar
在 scala 中执行了这些命令
import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext._
sc.stop
val conf = new SparkConf(true).set("spark.cassandra.connection.host","127.0.0.1")
val sc=new SparkContext("local[2]","test",conf)
import com.datastax.spark.connector._
到目前为止一切正常,但是当我执行时 -
val rdd=sc.cassandraTable("tutorialspoint","emp")
它给了我以下错误
error: bad symbolic reference. A signature in CassandraTableScanRDD.class refers to term driver
in package com.datastax which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling CassandraTableScanRDD.class.
error: bad symbolic reference. A signature in CassandraTableScanRDD.class refers to term core
in value com.datastax.driver which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling CassandraTableScanRDD.class.
error: bad symbolic reference. A signature in CassandraTableScanRDD.class refers to term core
in value com.datastax.driver which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling CassandraTableScanRDD.class.
已添加来自 cassandra lib 的 jar 以激发并重新使用它。 我使用 java 版本 1.8.0_72
我错过了什么?
【问题讨论】:
-
此链接可能对您有所帮助 - stackoverflow.com/questions/34641995/…。请记住使用兼容版本的 Cassandra jar 文件与 Spark 版本。
-
好的,Cassandra 版本和 jar 版本都有问题。必须卸载所有东西..
-
现在我已经使用了 cassandra 2.2.4 spark 1.6.0 scala-2.11.7 和 jar spark-cassandra-connector-java_2.11-1.5.0-RC1 ,以及你拥有的所有给定的 jar提及。它解决了这个错误,但现在当我 println(rdd.first) 它给出 java.lang.NoSuchMethodError: scala.runtime.ObjectRef.zero()Lscala/runtime/ObjectRef;
-
解决了购买降级到 spark1.4 谢谢
-
太棒了....如果我在第一条评论中提供的解决方案有效,那么请投票。它会帮助别人。
标签: apache-spark cassandra-2.0 spark-cassandra-connector