title: scala worksheet throwing error with spark
body: <p>I am trying run <em>spark</em> tests using <em>scala worksheet</em> in <em>Intellij</em>. But at the line of instantiation of <code>sparksession</code> or <code>sparkcontext</code>, the <em>worksheet</em> is throwing following error</p>
  
  <blockquote>
    <blockquote>
      <p>java.lang.ClassNotFoundException: org.apache.spark.serializer.JavaSerializer
          at java.net.URLClassLoader.findClass(scala tutorial.sc:377)
          at java.lang.ClassLoader.loadClass(scala tutorial.sc:420)
          at sun.misc.Launcher$AppClassLoader.loadClass(scala tutorial.sc:327)
          at java.lang.ClassLoader.loadClass(scala tutorial.sc:353)
          at java.lang.Class.forName0(scala tutorial.sc)
          at java.lang.Class.forName(scala tutorial.sc:344)
          at org.apache.spark.util.Utils$.classForName(scala tutorial.sc:225)
          at org.apache.spark.SparkEnv$.instantiateClass$1(scala tutorial.sc:256)
          at org.apache.spark.SparkEnv$.instantiateClassFromConf$1(scala tutorial.sc:277)
          at org.apache.spark.SparkEnv$.create(scala tutorial.sc:280)
          at org.apache.spark.SparkEnv$.createDriverEnv(scala tutorial.sc:170)
          at org.apache.spark.SparkContext.createSparkEnv(scala tutorial.sc:253)
          at org.apache.spark.SparkContext.(scala tutorial.sc:428)
          at org.apache.spark.SparkContext$.getOrCreate(scala tutorial.sc:2316)
          at org.apache.spark.sql.SparkSession$Builder$$anonfun$8.apply(scala tutorial.sc:827)
          at org.apache.spark.sql.SparkSession$Builder$$anonfun$8.apply(scala tutorial.sc:819)
          at #worksheet#.#worksheet#(scala tutorial.sc:116)</p>
    </blockquote>
  </blockquote>
  
  <p>I have tried unchecking the <code>Run worksheet in the compiler process</code> under <code>Worksheet</code> option of <code>Scala</code> setting which doesn't throw the error but doesn't even compile. </p>
  
  <p>It is a maven project and following are the dependencies I have </p>
  
  <pre><code> &lt;dependency&gt;
              &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
              &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
              &lt;version&gt;2.11.0&lt;/version&gt;
          &lt;/dependency&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.1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
              &lt;artifactId&gt;spark-streaming_2.11&lt;/artifactId&gt;
              &lt;version&gt;2.1.1&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.1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/com.holdenkarau/spark-testing-base_2.10 --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.holdenkarau&lt;/groupId&gt;
              &lt;artifactId&gt;spark-testing-base_2.11&lt;/artifactId&gt;
              &lt;version&gt;2.1.0_0.6.0&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Can somebody help me resolve this issue?</p>