I am new to Spark (Scala) and I am trying to run one spark application through spark submit. Unfortunately I am getting java.lang.ClassNotFoundException
exception.
Here is my spark submit command:
./spark-submit --class "spark.phoenix.a" --master local --deploy-mode client /home/ec2-user/phoenix-0.0.1-SNAPSHOT.jar
Here is my Exception:
java.lang.ClassNotFoundException: spark.phoenix.a
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.spark.util.Utils$.classForName(Utils.scala:175)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:689)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Here is my sample code:
package spark.phoenix
import org.apache.spark.SparkConf
import org.apache.spark.sql.SQLContext
object a {
def main(args: Array[String]) {
import org.apache.phoenix.spark._
import org.apache.spark.SparkContext
val zkQuorum = "localhost:2181"
val master = "local[*]"
val sparkConf = new SparkConf()
sparkConf.setAppName("phoenix-spark-save")
.setMaster(s"${master}")
val sc = new SparkContext(sparkConf)
val sqlContext = new SQLContext(sc)
// read from orders phoenix table
val df = sqlContext.phoenixTableAsDataFrame("TABLE1",
Seq.apply("ID", "COL1"),
zkUrl = Some.apply(s"${zkQuorum}") )
}
}