title: spark kafka streaming Error - " java.lang.NoClassDefFoundError: org/apache/spark/streaming/kafka/KafkaUtils
body: <p>I am writing a simple kafka - spark streaming code in eclipse to consume the messages from kafka broker using spark streaming. Below is the code, i receive the error when i try to run the code from eclipse.</p>
  
  <p>I also made sure the dependency jars are in place, kindly help to get rid of this error</p>
  
  <p>object spark_kafka_streaming {</p>
  
  <pre><code>def main(args: Array[String]) {
  
  val conf = new SparkConf()
    .setAppName("The swankiest Spark app ever")
    .setMaster("local[*]")
  
  val ssc = new StreamingContext(conf, Seconds(60))
  ssc.checkpoint("C:\\keerthi\\software\\eclipse-jee-mars-2-win32-  x86_64\\eclipse")
  
      println("Parameters:" + "zkorum:" + "group:" + "topicMap:"+"number of threads:")
  
  val zk = "xxxxxxxx:2181"
  val group = "test-consumer-group"
  val topics = "my-replicated-topic"
  val numThreads = 2
  
  val topicMap =  topics.split(",").map((_,numThreads.toInt)).toMap
  
  val lines = KafkaUtils.createStream(ssc,zk,group,topicMap).map(_._2)
  val words = lines.flatMap(_.split(" "))
  val wordCounts = words.map(x =&gt; (x,1L)).count()
  
  println("wordCounts:"+wordCounts)
  
  //wordCounts.print
    }
  }  
  </code></pre>
  
  <p>Exception:</p>
  
  <p>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/streaming/kafka/KafkaUtils$
      at org.firststream.spark_kakfa.spark_kafka_streaming$.main(spark_kafka_streaming.scala:30)
      at org.firststream.spark_kakfa.spark_kafka_streaming.main(spark_kafka_streaming.scala)
  Caused by: java.lang.ClassNotFoundException: org.apache.spark.streaming.kafka.KafkaUtils$
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 2 more</p>
  
  <p>Dependencies:</p>
  
  <pre><code>   &lt;dependency&gt;
        &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
      &lt;artifactId&gt;kafka_2.10&lt;/artifactId&gt;
      &lt;version&gt;0.8.1.1&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;exclusions&gt;
      &lt;exclusion&gt;
        &lt;artifactId&gt;jmxri&lt;/artifactId&gt;
        &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
        &lt;artifactId&gt;jms&lt;/artifactId&gt;
        &lt;groupId&gt;javax.jms&lt;/groupId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
        &lt;artifactId&gt;jmxtools&lt;/artifactId&gt;
        &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt;
      &lt;/exclusion&gt;
    &lt;/exclusions&gt;
   &lt;/dependency&gt;
  
  &lt;dependency&gt;
  &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
  &lt;artifactId&gt;kafka-clients&lt;/artifactId&gt;
  &lt;version&gt;0.8.2.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
      &lt;artifactId&gt;spark-streaming-kafka_2.10&lt;/artifactId&gt;
      &lt;version&gt;1.2.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
  &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
  &lt;artifactId&gt;spark-streaming_2.10&lt;/artifactId&gt;      
  &lt;version&gt;1.2.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>