Explore Courses Blog Tutorials Interview Questions
0 votes
in Big Data Hadoop & Spark by (11.4k points)

I've downloaded the prebuild version of spark 1.4.0 without hadoop (with user-provided Haddop). When I ran the spark-shell command, I got this error:

> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/
        at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSpa
        at org.apache.spark.deploy.SparkSubmitArguments$$anonfun$mergeDefaultSpa
        at scala.Option.getOrElse(Option.scala:120)
        at org.apache.spark.deploy.SparkSubmitArguments.mergeDefaultSparkPropert
        at org.apache.spark.deploy.SparkSubmitArguments.<init>(SparkSubmitArgume
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:106)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStr
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        ... 7 more


I've searched on Internet, it is said that HADOOP_HOME has not been set yet in spark-env.cmd. But I cannot find spark-env.cmd in the spark installation folder. I've traced the spark-shell command and it seems that there are no HADOOP_CONFIG in there. I've tried to add the HADOOP_HOME on environment variable but it still give the same exception.


1 Answer

0 votes
by (32.3k points)
edited by

The "without Hadoop" in the Spark's build name is misleading: it shows that the build is not tied to a specific Hadoop distribution, not that it is meant to run without it: the user should indicate where to find Hadoop (see

One clean way to fix this issue is to:

  • Obtain Hadoop Windows binaries. Ideally build them, but this isn't an easy task. Otherwise Google some up, for instance currently you can download 2.6.0 from here:
  • Just, create a spark-env.cmd file(modify Hadoop path to match your installation): 

         @echo off

          set HADOOP_HOME=D:\Utils\hadoop-2.7.1

          set PATH=%HADOOP_HOME%\bin;%PATH%

          set SPARK_DIST_CLASSPATH=<paste here the output of

          %HADOOP_HOME%\bin\hadoop classpath>

  • Then, put this spark-env.cmd either in a conf folder located at the similar level as your Spark base folder (which may look weird), or in a folder indicated by the SPARK_CONF_DIR environment variable.

If you want to know more about Spark, then do check out this awesome video tutorial:

Browse Categories