'Java 17 solution for Spark - java.lang.NoClassDefFoundError: Could not initialize class org.apache.spark.storage.StorageUtils
There are some solutions here
The mentioned error probably corresponds to the following exception:
java.lang.IllegalAccessError: class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x12a94400) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module
Switching back to Java 11 or below is not a solution for me. How can this be solved with Java 17?
Solution 1:[1]
You can solve this problem (and about each and every Java 17 problem) by adding a --add-exports
statement to the corresponding Java call. In hits case --add-exports java.base/sun.nio.ch=ALL-UNNAMED
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |