title: Kafka Consumer Example throws ClassNotFoundException
body: <p>I have Kafka 0.8 built using Scala 2.8; the steps followed from <a href="https://cwiki.apache.org/confluence/display/KAFKA/Kafka+0.8+Quick+Start" rel="nofollow">this site</a>. I could also run the kafka-console-producer and kafka-console-consumer examples successfully. I am now experimenting with <a href="https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example" rel="nofollow">Consumer Group Example</a> (Please the "Full Source Code" section). The exception I get is below:</p>
  
  <pre><code>java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
      at java.lang.Thread.run(Thread.java:701)
  Caused by: java.lang.NoClassDefFoundError: scala/Tuple2$mcJJ$sp
      at kafka.consumer.ConsumerConfig.&lt;init&gt;(Unknown Source)
      at ConsumerGroupExample.createConsumerConfig(ConsumerGroupExample.java:55)
      at ConsumerGroupExample.&lt;init&gt;(ConsumerGroupExample.java:18)
      at ConsumerGroupExample.main(ConsumerGroupExample.java:64)
      ... 6 more
  Caused by: java.lang.ClassNotFoundException: scala.Tuple2$mcJJ$sp
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
      ... 10 more
  </code></pre>
  
  <p>My dependencies looks like this:</p>
  
  <pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
    &lt;groupId&gt;junit&lt;/groupId&gt;
    &lt;artifactId&gt;junit&lt;/artifactId&gt;
    &lt;version&gt;3.8.1&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &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.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;javax.inject&lt;/groupId&gt;
      &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
      &lt;version&gt;1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
      &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
      &lt;version&gt;2.8.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j&lt;/artifactId&gt;
      &lt;version&gt;1.2.17&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.101tec&lt;/groupId&gt;
      &lt;artifactId&gt;zkclient&lt;/artifactId&gt;
      &lt;version&gt;0.3&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.yammer.metrics&lt;/groupId&gt;
      &lt;artifactId&gt;metrics-core&lt;/artifactId&gt;
      &lt;version&gt;2.2.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>As a note I could get it running with a <a href="https://github.com/mumrah/kafka-python/blob/master/example.py" rel="nofollow">Python client</a>. But I really need this done in <strong>Java</strong>. Would really appreciate any help! </p>