3

我是 Spark 的新手,需要有关错误的帮助: java.lang.NoClassDefFoundError: org/apache/spark/rdd/RDD$

我正在 Scala 中创建一个独立的 Spark 示例。我跑sbt clean packagesbt assembly打包了scala spark代码。两者都成功完成,没有任何错误。对 RDD 的任何操作都会引发错误。解决此问题的任何指示都将非常有帮助。

spark-submit我使用命令调用作业。

$SPARK_HOME/bin/spark-submit --class org.apache.spark.examples.GroupTest /Users/../spark_workspace/spark/examples/target/scala-2.10/spark-examples_2.10-1.3.0-SNAPSHOT.jar

4

1 回答 1

0

I managed to throw this error and get past it. This is definitely a YMMV answer, but I leave it here in case it eventually helps someone.

In my case, I was running a homebrew installed spark (1.2.0) and mahout (0.11.0) on a mac. It was pretty baffling to me because if I ran a mahout command line by hand I didn't get the error, but if I invoked it from within some python code it threw the error.

I realized that I had updated my SPARK_HOME variable in my profile to use 1.4.1 instead and had re-sourced it in my by-hand terminal. The terminal where I was running the python code was still using 1.2.0. I re-sourced my profile in my python terminal and now it "just works."

The whole thing feels very black magicky, if I were to guess some rational reason for this error being thrown, maybe it's because one moving part assumes a different spark version, architecture, whatever than you have. That seems to be the solution hinted at in the comments, too.

于 2015-09-18T14:25:05.393 回答