Reputation: 21
Spark - a tiny web framework for Java 8
It's always mentioned that this framework is for Java 8. Can anyone confirm that this framework is forward compatible? Can we use the older versions of this framework for Java 17? Or do we need use the latest version of the framework for Java 17? Is there any Java compatibility matrix for this framework versions? Please help me with the link if we have such thing.
I read the documentation, but I didn't find whether this is forward compatible or not. I also did not find any Java compatibility matrix.
Upvotes: 1
Views: 3351
Reputation: 39
I using the last springboot version 3.3.x with many spark versions as 2.x and 3.x with JDK 17 and the error is always the same:
java.lang.IllegalAccessError: class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x625732) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x625732
I don't understand why some people said that spark works with JDK17, because for me is impossible work it ...
<!-- Spark Core dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>${SPARK_VERSION}</version>
</dependency>
<!-- Spark SQL dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>${SPARK_VERSION}</version>
</dependency>
Upvotes: 0
Reputation: 11120
Let's see and not try to guess.
The dependency, that sparkjava.com
demonstrates to be used is:
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.9.4</version>
</dependency>
If we'll open its pom.xml
, we'll see this:
<properties>
<java.version>1.8</java.version>
<jetty.version>9.4.48.v20220622</jetty.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<powermock.version>1.7.4</powermock.version>
<mockito.version>1.10.19</mockito.version>
</properties>
This means, that there is no explicit support for Java 17 and features that pertain to Java 17 specifically, may not work.
Upvotes: 1
Reputation: 4323
I have used SparkJava in production with Java 17 since 2022-12-09 and have not had any Java 17 related issues.
Before that, we used Java 11 from 2020-04-06.
The only difference I have seen in our production environment is that we are using less memory with Java 17 than with Java 11.
Try it yourself and see if you have any issues. It works great for us.
Upvotes: 1