Spark-submit ClassNotFound exception

前端 未结 5 940
我寻月下人不归
我寻月下人不归 2020-12-29 06:01

I\'m having problems with a \"ClassNotFound\" Exception using this simple example:

import org.apache.spark.SparkContext
import org.apache.spark.SparkContext.         


        
5条回答
  •  感动是毒
    2020-12-29 06:21

    You should set the SPARK_CLASS_PATH in spark-env.sh file like this:

    SPARK_LOCAL_IP=your local ip 
    SPARK_CLASSPATH=your external jars
    

    and you should submit with spark shell like this:spark-submit --class your.runclass --master spark://yourSparkMasterHostname:7077 /your.jar

    and your java code like this:

    SparkConf sparkconf = new SparkConf().setAppName("sparkOnHbase");  JavaSparkContext sc = new JavaSparkContext(sparkconf);
    

    then it will work.

提交回复
热议问题