title: Error: java.lang.NoClassDefFoundError: org/apache/spark/internal/Logging
body: <p>I am trying to create a SparkSession (to run NaiveBayes model) in spark but getting this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/internal/Logging
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at java.net.URLClassLoader.defineClass(Unknown Source)
  at java.net.URLClassLoader.access$100(Unknown Source)
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  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)
  at com.bnym.spark.SparkML.App.main(App.java:20)
  Caused by: java.lang.ClassNotFoundException: org.apache.spark.internal.Logging
  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)
  ... 13 more
  </code></pre>
  
  <p>My java code is very simple:</p>
  
  <pre><code>package com.bnym.spark.SparkML;
  
  import org.apache.spark.ml.classification.NaiveBayes;
  import org.apache.spark.ml.classification.NaiveBayesModel;
  import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator;
  import org.apache.spark.sql.Dataset;
  import org.apache.spark.sql.Row;
  import org.apache.spark.sql.SparkSession;
  
  /**
   * Naive Bayes Example
   *
   */
  public class App 
  {
   public static void main( String[] args )
   {
    //System.out.println( "Hello World!" );       
    SparkSession spark = SparkSession
      .builder()
      .appName("NB")
      .getOrCreate();
  
    // Load training data
    //Dataset&lt;Row&gt; dataFrame = spark.read().format("libsvm").load("data/mllib/sample_libsvm_data.txt");
   }
  }
  </code></pre>
  
  <p>And my pom.xml file is as follows:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.bnym.spark&lt;/groupId&gt;
    &lt;artifactId&gt;SparkML&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;SparkML&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
   &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
  
    &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;!-- https://mvnrepository.com/artifact/org.apache.spark/spark-mllib_2.10 --&gt;
  &lt;dependency&gt;
   &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
   &lt;artifactId&gt;spark-mllib_2.10&lt;/artifactId&gt;
   &lt;version&gt;1.6.0&lt;/version&gt;
   &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;  
  
   &lt;!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql_2.10 --&gt;
  &lt;dependency&gt;
   &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
   &lt;artifactId&gt;spark-sql_2.10&lt;/artifactId&gt;
   &lt;version&gt;2.0.0&lt;/version&gt;    
  &lt;/dependency&gt;
  
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Would really appreciate help in figuring out why the error.</p>