AnsweredAssumed Answered

Spark Shell not starting : Exception in thread "main" java.lang.IllegalStateException

Question asked by shrilesh.naik on Mar 1, 2018
Latest reply on Mar 22, 2018 by maprcommunity
Branched from an earlier discussion

 There is a Oozie java action that triggers a shell script which invokes spark-submit

 

below is our shell script -

 

xport HADOOP_USER_NAME=abcd

export APP_PATH=/xyz
echo $HADOOP_USER_NAME

echo $APP_PATH

export SPARK_HOME=/opt/mapr/spark/spark-2.1.0
/opt/mapr/spark/spark-2.1.0/bin/spark-submit --jars $APP_PATH/abcd/mylib.jar --class org.apache.spark.examples.SparkPi --master yarn --conf spark.executor.extraJavaOptions="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp" --conf spark.executor.memory=1G --conf spark.executor.instances=1 --conf spark.submit.deployMode=cluster $APP_PATH/abcd/sparkpi1.jar 10

 

Facing below issue ,

 

Exception in thread "main" java.lang.IllegalStateException: basedir job.jar/lib does not exist.
at org.apache.tools.ant.DirectoryScanner.scan(DirectoryScanner.java:871)
at org.apache.spark.classpath.ClasspathFilter$$anonfun$resolveClasspath$1.apply(ClasspathFilter.scala:47)
at org.apache.spark.classpath.ClasspathFilter$$anonfun$resolveClasspath$1.apply(ClasspathFilter.scala:44)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.mutable.ArrayOps$ofRef.flatMap(ArrayOps.scala:186)
at org.apache.spark.classpath.ClasspathFilter$.resolveClasspath(ClasspathFilter.scala:44)
at org.apache.spark.classpath.ClasspathFilter$.main(ClasspathFilter.scala:31)
at org.apache.spark.classpath.ClasspathFilter.main(ClasspathFilter.scala)
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
at org.apache.spark.deploy.SparkSubmitArguments.handle(SparkSubmitArguments.scala:403)
at org.apache.spark.launcher.SparkSubmitOptionParser.parse(SparkSubmitOptionParser.java:163)
at org.apache.spark.deploy.SparkSubmitArguments.<init>(SparkSubmitArguments.scala:98)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:109)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStream
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more

Outcomes