title: Resolving NoClassDefFoundError: org/apache/spark/Logging exception
body: <p>I was trying out hbase-spark connector. To start with, I am trying out <a href="https://github.com/apache/hbase/blob/master/hbase-spark/src/main/java/org/apache/hadoop/hbase/spark/example/hbasecontext/JavaHBaseBulkPutExample.java" rel="nofollow noreferrer">this</a> code.</p>
  
  <p>My pom dependencies are:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
          &lt;artifactId&gt;spark-core_2.11&lt;/artifactId&gt;
          &lt;version&gt;2.0.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
          &lt;artifactId&gt;spark-sql_2.11&lt;/artifactId&gt;
          &lt;version&gt;2.0.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.hbase&lt;/groupId&gt;
          &lt;artifactId&gt;hbase-spark&lt;/artifactId&gt;
          &lt;version&gt;2.0.0-alpha4&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I am getting following exception while running the code:</p>
  
  <blockquote>
    <blockquote>
      <p>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/Logging
              at java.lang.ClassLoader.defineClass1(Native Method)
              at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
              at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
              at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
              at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
              at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
              at org.apache.hadoop.hbase.spark.JavaHBaseContext.(JavaHBaseContext.scala:46)
              at com.myproj.poc.sparkhbaseneo4j.App.main(App.java:71)
          Caused by: java.lang.ClassNotFoundException: org.apache.spark.Logging
              at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
              ... 14 more</p>
    </blockquote>
  </blockquote>
  
  <p><code>com.myproj.poc.sparkhbaseneo4j.App.main(App.java:71)</code> is <a href="https://github.com/apache/hbase/blob/master/hbase-spark/src/main/java/org/apache/hadoop/hbase/spark/example/hbasecontext/JavaHBaseBulkPutExample.java#L67" rel="nofollow noreferrer">line 67</a> in github code.</p>
  
  <p>I checked <a href="https://stackoverflow.com/questions/40287289/java-lang-noclassdeffounderror-org-apache-spark-logging">this thread</a>. It says that I should include same versions of all libraries. Earlier, I had 2.3.0 versions of spark libraries in my pom. But I realized that <code>hbase-spark</code> has latest version <code>2.0.0</code>. So I downgraded versions of of all spark libraries to <code>2.0.0</code>. But I am still getting the same exception.</p>
  
  <p>Or do I have to stick to <code>1.X.X</code> versions only for using this, as <a href="https://stackoverflow.com/a/48396947/1317018">this</a> answer says its been removed after version 1.5.2?</p>