12

Why can not Spark find the classes in this pot?

 4 years ago
source link: https://www.codesd.com/item/why-can-not-spark-find-the-classes-in-this-pot.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Why can not Spark find the classes in this pot?

advertisements

I am new to spark. I am trying to compile and run a spark application that requires classes from an (external) jar file on my local machine. If I open the jar (on ~/Desktop) I can see the missing class in the local jar but when I run spark I get

NoClassDefFoundError: edu/stanford/nlp/ie/AbstractSequenceClassifier

I add the jar to the spark context like this

String[] jars = {"/home/pathto/Desktop/stanford-corenlp-3.5.0.jar"};
SparkConf conf = new SparkConf().setAppName("Simple Application").setJars(jars);

Then I try to run a submit script like this

/home/pathto/Downloads/spark-1.2.0-bin-hadoop2.4/bin/spark-submit \
  --class "SimpleApp" \
  --master local[4] \
  target/simple-project-1.0.jar \
  --jars local[4] /home/abe/Desktop/stanford-corenlp-3.5.0.jar

and hit the NoClassDefFoundError.

I get that this means that the worker threads can't find the class from the jar. But I am not sure what I am doing wrong. I have tried different syntaxes for the last line (below) but none works.

  --addJars local[4] /home/abe/Desktop/stanford-corenlp-3.5.0.jar
  --addJars local:/home/abe/Desktop/stanford-corenlp-3.5.0.jar
  --addJars local:/home/abe/Desktop/stanford-corenlp-3.5.0.jar

How can I fix this error?


Try specifying the jar file location using file:/path/to/jar/jarfile.jar/. Using local: means that the jar file has to already exist in the specified location on each worker node. For more information, see the "Advanced Dependency Management" section of the Submitting Applications documentation.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK