2015-11-15 105 views
0

我試圖讓卡桑德拉2.2.3(在本地主機上運行)與星火1.5.1和火花卡桑德拉連接器(1.5.0-M2)的最後一個版本的工作。的NoSuchMethodError與星火卡桑德拉連接器

下面是我使用的基本代碼片段。密鑰空間和表已經被創建。

import com.datastax.spark.connector._ 
import org.apache.spark.{SparkConf, SparkContext} 

val conf = new SparkConf().setMaster("local[*]").set("spark.cassandra.connection.host", "localhost") 
val sc = new SparkContext(conf) 

val collection = sc.parallelize(Seq(("word1", 30), ("word2", 40))) 
collection.saveToCassandra("test", "words", SomeColumns("word", "count")) 

它編譯沒有與SBT裝配任何問題,但在提交應用程序時,我得到這個錯誤:

Exception in thread "main" java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)Lscala/reflect/api/JavaUniverse$JavaMirror; 
at Streamer$.main(Streamer.scala:33) 
at Streamer.main(Streamer.scala) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:483) 
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:672) 
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180) 
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205) 
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:120) 
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) 

回答

1

我用scala_2.11,顯然我的火花版本使用scala_2.10。所以切換到scala_2.10在build.sbt爲我工作。