2017-06-06 5 views
1

Datastax Cassandraコネクタを使用してCassandraに接続するApache Sparkアプリケーションを作成しようとしています。エラーSparkとCassandraのSymbian 'タイプ<none> .package.DataFrame'がクラスパスにありません

Symbol 'type <none>.package.DataFrame' is missing from the classpath.

マイbuild.sbt

name := "spark-app" 
version := "1.0" 
scalaVersion := "2.11.11" 


libraryDependencies ++= Seq(
    "com.datastax.spark" %% "spark-cassandra-connector" % "2.0.0", 
    "org.apache.spark" %% "spark-core" % "2.1.1" % "provided" 
) 

resolvers += "Spark Packages Repo" at "https://dl.bintray.com/spark-packages/maven" 

私の単純なアプリケーション:

package com.budgetbakers.be.dwh.spark 
import com.datastax.spark.connector._ 
import org.apache.spark.{SparkConf, SparkContext} 

object Distinct { 
    def main(args: Array[String]): Unit = { 
    val conf = new SparkConf(true) 
     .set("spark.cassandra.connection.host", "127.0.0.1") 

    val sc = new SparkContext(conf) 
    println(sc.cassandraTable("ks", "users").select("gender").distinct().collect().mkString(",")) 
    sc.stop() 
    } 
} 

私はpackageプロジェクトにしようとしたとき、私はコンパイルエラーを以下の取得:

[error] /.../Distinct.scala:18: Symbol 'type <none>.package.DataFrame' is missing from the classpath. 
[error] This symbol is required by 'value com.datastax.spark.connector.package.dataFrame'. 
[error] Make sure that type DataFrame is in your classpath and check for conflicting dependencies with `-Ylog-classpath`. 
[error] A full rebuild may help if 'package.class' was compiled against an incompatible version of <none>.package. 
[error]  println(sc.cassandraTable("ks", "users").select("gender").distinct().collect().mkString(",")) 
[error]   ^

私は何かが足りないのですか?おそらくいくつかの依存関係の競合がありますか?私が使用したアプリの

バージョン:

  • カサンドラ:3.1
  • apacheの火花:2.1.1
  • スパークカサンドラコネクタ:2.0.0
  • スカラ:2.11
  • SBT: 0.13.15
  • sbtアセンブリプラグイン:0.14.0

答えて

3

spark-sql依存関係とコアライブラリを追加してみてください。将来の参考として、ビルドファイルの例があります。here

+0

Cassandra Sparkコネクタの推移的な依存性ではありませんか?ちょっと興味があるんだけど。 OPがSpark SQLをまったく使用していないとすれば、なぜ依存関係がOPの 'build.sbt'にあるのか理解できません。 –

+0

パッケージにはパッケージを含めるという意味があります。すべてのクラスを検索する必要があります。なぜそれがsccで自動的に引き込まれないのですが、私はなぜその決定がなされたのか覚えていないでしょう、おそらく複数のスパークバージョン – RussS

関連する問題