Ryan
Ryan

Reputation: 72

Mahout 0.11.1 Spark-Shell NoClassDefFoundError

I am trying to get the Mahout Spark-Shell to run on the Cloudera QuickStart VM

Mahout: Version 0.11.1

Spark: Version 1.5.0-cdh5.5.1

Java: 1.7.0_67

.bashrc is set as

export MAHOUT_HOME=/home/cloudera/Desktop/Mahout_0_11_1
export MAHOUT_LOCAL=true
export SPARK_HOME=/usr/lib/spark
export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera

When I run the Mahout Spark-Shell I get the following error message.

java.lang.NoClassDefFoundError: com/sun/jersey/spi/container/servlet/ServletContainer
    at org.apache.spark.status.api.v1.ApiRootResource$.getServletHandler(ApiRootResource.scala:187)
    at org.apache.spark.ui.SparkUI.initialize(SparkUI.scala:68)
    at org.apache.spark.ui.SparkUI.<init>(SparkUI.scala:74)
    at org.apache.spark.ui.SparkUI$.create(SparkUI.scala:190)
    at org.apache.spark.ui.SparkUI$.createLiveUI(SparkUI.scala:141)
    at org.apache.spark.SparkContext.<init>(SparkContext.scala:466)
    at org.apache.mahout.sparkbindings.package$.mahoutSparkContext(package.scala:91)
    at org.apache.mahout.sparkbindings.shell.MahoutSparkILoop.createSparkContext(MahoutSparkILoop.scala:89)
...

This is then followed by:

Mahout distributed context is available as "implicit val sdc".
java.lang.NullPointerException
    at org.apache.spark.sql.execution.ui.SQLListener.<init>(SQLListener.scala:34)
    at org.apache.spark.sql.SQLContext.<init>(SQLContext.scala:77)
    at org.apache.spark.repl.SparkILoop.createSQLContext(SparkILoop.scala:1033)
    at $iwC$$iwC.<init>(<console>:11)
    at $iwC.<init>(<console>:19)

Upvotes: 0

Views: 388

Answers (1)

fcnorman
fcnorman

Reputation: 1186

in spark-env.sh,

add

export SPARK_DIST_CLASSPATH=$(/path/to/hadoop/bin/hadoop classpath)

and make sure that jersey-servlet-1.9.jar is on the classpath.

go through all of your *-env.sh scripts and be as explicit as possible about setting the environment variables, checking each, and then checking the logs for errors.

cd / find . -name jersey-servlet-1.9.jar and make sure the path where this file is found is on your classpath

Edit: Add jersey-server-1.9.jar to $MAHOUT_HOME/lib/ directory.

Upvotes: 2

Related Questions