scala - Resolve spark-avro error = Failed to load class for data source: com.databricks.spark.avro -


i trying use spark-avro library process avro files. using sbt:

build.sbt:

librarydependencies ++= seq(   "org.apache.spark" %% "spark-sql" % "1.3.0",   "com.databricks" %% "spark-avro" % "1.0.0") 

tester.scala:

import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ import org.apache.spark.sparkconf import org.apache.spark.sql._ import com.databricks.spark.avro._  object tester {   def main(args: array[string]) {     val conf = new sparkconf().setappname("simpleapplication").setmaster("local")     val sc = new sparkcontext(conf)      // creates dataframe specified file     val df = sqlcontext.load("episodes.avro", "com.databricks.spark.avro")   } } 

when run tester in intellij ide, following stack trace:

exception in thread "main" java.lang.noclassdeffounderror:        org/apache/avro/mapred/fsinput     @ com.databricks.spark.avro.avrorelation.newreader(avrorelation.scala:111)     @ com.databricks.spark.avro.avrorelation.<init>(avrorelation.scala:53)     @ com.databricks.spark.avro.defaultsource.createrelation(defaultsource.scala:41)     @ org.apache.spark.sql.sources.resolveddatasource$.apply(ddl.scala:290) 

when run:

$ sbt package $ ~/spark-1.3.1/bin/spark-submit --class "tester" target/scala-2.10/project_2.10-0.1-snapshot.jar 

i following stack trace:

exception in thread "main" java.lang.runtimeexception: failed load class data source: com.databricks.spark.avro     @ scala.sys.package$.error(package.scala:27)     @ org.apache.spark.sql.sources.resolveddatasource$.lookupdatasource(ddl.scala:194)     @ org.apache.spark.sql.sources.resolveddatasource$.apply(ddl.scala:205)     @ org.apache.spark.sql.sqlcontext.load(sqlcontext.scala:697) 

what can resolve error? appreciated. thanks!!

"sbt package" not include dependencies, try sbt-assembly instead.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -