JDK21 Spark3.5.0
使用JDK21做spark开发
启动代码出现Exception in thread "main" java.lang.IllegalAccessError: class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x461ad730) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x461ad730
报错信息
需要在环境变量中设置JAVA_OPT
和JAVA_TOOL_OPTIONS
为--add-exports=java.base/sun.nio.ch=ALL-UNNAMED
Exception in thread "main" java.lang.IllegalAccessError: class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x461ad730) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x461ad730
at org.apache.spark.storage.StorageUtils$.<clinit>(StorageUtils.scala:213)
at org.apache.spark.storage.BlockManagerMasterEndpoint.<init>(BlockManagerMasterEndpoint.scala:121)
at org.apache.spark.SparkEnv$.$anonfun$create$9(SparkEnv.scala:358)
at org.apache.spark.SparkEnv$.registerOrLookupEndpoint$1(SparkEnv.scala:295)
at org.apache.spark.SparkEnv$.create(SparkEnv.scala:344)
at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:196)
at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:284)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:483)
at com.lihaozhe.course01.ScalaDemo01$.main(ScalaDemo01.scala:20)
at com.lihaozhe.course01.ScalaDemo01.main(ScalaDemo01.scala)
文章来源:https://www.toymoban.com/news/detail-787940.html
一切正常文章来源地址https://www.toymoban.com/news/detail-787940.html
Picked up JAVA_TOOL_OPTIONS: --add-exports=java.base/sun.nio.ch=ALL-UNNAMED
Using Spark's default log4j profile: org/apache/spark/log4j2-defaults.properties
到了这里,关于cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!