title: How to fix 'Unsupported class file major version 55' while executing 'org.apache.spark.sql.DataSet.collectAsList()'
body: <p>I'm creating a Java RESTAPI Spring Boot application that uses spark to get some data from the server. When I try to convert from Dataset to List it fails.</p>
  
  <p>I've tried jdk8 and jdk11 to compile and execute the code but I get the same 'java.lang.IllegalArgumentException: Unsupported class file major version 55', in the past, I've solved this issue by updating Java version, but it's not working for this.</p>
  
  <p>I'm using: </p>
  
  <ul>
  <li><p>JDK 11.0.2</p></li>
  <li><p>Spring Boot 2.1.4</p></li>
  <li><p>Spark 2.4.2</p></li>
  </ul>
  
  <p>This is the code I'm executing:</p>
  
  <pre><code>Dataset&lt;Row&gt; dataFrame = sparkSession.read().json("/home/data/*.json");
          dataFrame.createOrReplaceTempView("events");
          Dataset&lt;Row&gt; resultDataFrame = sparkSession.sql("SELECT * FROM events WHERE " + predicate); 
          Dataset&lt;Event&gt; eventDataSet = resultDataFrame.as(Encoders.bean(Event.class));
          return eventDataSet.collectAsList();
  </code></pre>
  
  <p>The query works, actually while debugging you can see information in both resultDataFrame and eventDataSet.</p>
  
  <p>I expect the output to be a proper list of Events, but I'm getting the exception:</p>
  
  <pre><code>[http-nio-8080-exec-2] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 55] with root cause
  java.lang.IllegalArgumentException: Unsupported class file major version 55
      at org.apache.xbean.asm6.ClassReader.&lt;init&gt;(ClassReader.java:166)
      at org.apache.xbean.asm6.ClassReader.&lt;init&gt;(ClassReader.java:148)
      at org.apache.xbean.asm6.ClassReader.&lt;init&gt;(ClassReader.java:136)
      at org.apache.xbean.asm6.ClassReader.&lt;init&gt;(ClassReader.java:237)
      at org.apache.spark.util.ClosureCleaner$.getClassReader(ClosureCleaner.scala:49)
      at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:517)
      at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:500)
      at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
      at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:134)
      at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:134)
      at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:236)
      at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
      at scala.collection.mutable.HashMap$$anon$1.foreach(HashMap.scala:134)
      at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
      at org.apache.spark.util.FieldAccessFinder$$anon$3.visitMethodInsn(ClosureCleaner.scala:500)
  .....
  </code></pre>
  
  <p>UPDATE BY COMMENTS:
  For Java 8, I change pom to aim java 8:</p>
  
  <pre><code>&lt;java.version&gt;1.8&lt;/java.version&gt;
  </code></pre>
  
  <p>And then update project, maven clean, maven install and then run.
  Getting same version 55 error</p>