title: Unread block data while reading from Java Spark
body: <p>I'm trying to read some files from HDFS and/or from the filesystem and  I get this exception</p>
  
  <pre><code>    Driver stacktrace:]
              [unread block data]
      ]org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 4 times, most recent failure: Lost task 0.3 in stage 0.0 (TID 6, C-4073.CM.ES, executor 1): java.lang.IllegalStateException: unread block data
      at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2421)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1382)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:76)
      at org.apache.spark.serializer.JavaSerializerInstance.deserialize(JavaSerializer.scala:115)
      at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:222)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>The code reading from HDFS:</p>
  
  <pre><code>    JavaRDD&lt;String&gt; textFile = sc.textFile("file:///PathToFile");
  </code></pre>
  
  <p>The code reading from the filesystem:</p>
  
  <pre><code>    JavaRDD&lt;String&gt; textFile=sc.textFile("hdfs:///PathToFile");
  </code></pre>
  
  <p>I've been searching, and users usually said that it might be an error due to different Java versions, but I've checked it:</p>
  
  <p>My Cluster:</p>
  
  <pre><code>$ java -version
  java version "1.7.0_67"
  Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
  Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
  </code></pre>
  
  <p>My local machine:</p>
  
  <pre><code>$ java -version
  java version "1.7.0_76"
  Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
  </code></pre>
  
  <p>My pom.xml:</p>
  
  <pre><code>&lt;properties&gt;
      &lt;jdk.version&gt;1.7&lt;/jdk.version&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;springboot.version&gt;1.5.3.RELEASE&lt;/springboot.version&gt;
      &lt;springint.version&gt;4.3.10.RELEASE&lt;/springint.version&gt;
      &lt;cdh.version&gt;5.10.1&lt;/cdh.version&gt;
      &lt;solr.version&gt;4.10.3-cdh${cdh.version}&lt;/solr.version&gt;
      &lt;hbase.version&gt;1.2.0-cdh${cdh.version}&lt;/hbase.version&gt;
      &lt;kafka.version&gt;0.9.0-kafka-2.0.2&lt;/kafka.version&gt;
      &lt;rt-framework.version&gt;2.3.5&lt;/rt-framework.version&gt;
      &lt;tas.version&gt;4.0.0&lt;/tas.version&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>I'm not sure if my problem is about the Java versions, because I've no problem writing/reading from kafka, or querying from hive.</p>
  
  <p>Thanks you in advance and sorry for my bad english.</p>