title: mapreduce Job() threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.hadoop.mapreduce.Job.toString()
body: <p>I'm running a Spark Streaming program that uses a mapreduce Job to write files in AvroParquet format. The program works properly when executed on the cluster but fails in local.</p>
  
  <p>The code </p>
  
  <pre><code>import org.apache.hadoop.mapreduce.Job
  val job = Job.getInstance()
  </code></pre>
  
  <p>throws the following exception: </p>
  
  <pre><code>Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.hadoop.mapreduce.Job.toString()
  </code></pre>
  
  <p>Here is the code used to submit the spark streaming job: </p>
  
  <pre><code>    SparkConf conf = new SparkConf(false)
                  .setMaster("local[2]")
                  .setAppName("test");
      SparkContext sc = new SparkContext(conf);
      MyClass job = new MyClass();
      job.run();
  
      class MyClass(){
      protected def run(): Unit ={
  
          val ssc: StreamingContext = createStreamingContext(parameters)
          // here there is something like 
          // stream.map(func1).reduceBykey(func2).foreachRDD(rdd =&gt; {val job = Job.getInstance()})
          ssc.start()
      }
  </code></pre>