java - ClassNotFoundException in spark-sbumit for scala code -


when export program jar file , execute java.lang.classnotfoundexception error.

the code i'm using below.

thanks in advance assistance

sbt

name := "testfunctions"  version := "1.0"  scalaversion := "2.11.8"  librarydependencies += "com.github.pathikrit" %% "better-files" % "2.17.1" librarydependencies ++= seq(   "org.apache.spark" % "spark-core_2.11" % "2.1.0",   "org.apache.spark" % "spark-sql_2.11" % "2.1.0",   "com.github.pathikrit" %% "better-files" % "2.17.1" )  initialize := {   val _ = initialize.value   if (sys.props("java.specification.version") != "1.8")     sys.error("java 8 required project.") } 

scala code

/**   * created cloudera on 7/23/17.   */  import better.files.file._ import org.apache.spark.sql.sparksession   object func {     val fordelete = (root/"/home/cloudera/documents/fabo")     .createifnotexists()    if (fordelete.exists)     fordelete.delete()     def main(args:array[string]) : unit = {      val spark = sparksession.builder       .master("local")       .appname("get forex data")       .getorcreate()      }  } 

command line executing jar file

spark-submit --class func --master local[*] /home/cloudera/testfunctions/out/artifacts/testfunctions_jar 

error

java.lang.classnotfoundexception: func     @ java.net.urlclassloader.findclass(urlclassloader.java:381)     @ java.lang.classloader.loadclass(classloader.java:424)     @ java.lang.classloader.loadclass(classloader.java:357)     @ java.lang.class.forname0(native method)     @ java.lang.class.forname(class.java:348)     @ org.apache.spark.util.utils$.classforname(utils.scala:229)     @ org.apache.spark.deploy.sparksubmit$.org$apache$spark$deploy$sparksubmit$$runmain(sparksubmit.scala:695)     @ org.apache.spark.deploy.sparksubmit$.dorunmain$1(sparksubmit.scala:187)     @ org.apache.spark.deploy.sparksubmit$.submit(sparksubmit.scala:212)     @ org.apache.spark.deploy.sparksubmit$.main(sparksubmit.scala:126)     @ org.apache.spark.deploy.sparksubmit.main(sparksubmit.scala) 

** the tree structure code live looks below ** - class called func lives in scala directory

\main     \java     \resources     \scala         -func(class)     \scala-2.11 

output jar tf name_of_jar.jar

meta-inf/manifest.mf func.class func$.class 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -