Skip to content

[BUG] JDK17  #1552

@fenyh

Description

@fenyh

问题描述

简要描述您碰到的问题。

Caused by: java.lang.IllegalAccessError: class com.alibaba.fastjson2.writer.OWG_2_1_FileChannelImpl (in unnamed module @0x7404e959) cannot access class sun.nio.ch.FileChannelImpl (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x7404e959
at com.alibaba.fastjson2.writer.OWG_2_1_FileChannelImpl.write(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_1_2_FileInputStream.write(Unknown Source)
at com.alibaba.fastjson2.writer.FieldWriterObject.write(FieldWriterObject.java:354)
at com.alibaba.fastjson2.writer.ObjectWriter8.write(ObjectWriter8.java:86)
at com.alibaba.fastjson2.writer.ObjectWriterArray.write(ObjectWriterArray.java:85)
at com.alibaba.fastjson2.writer.ObjectWriterArray.write(ObjectWriterArray.java:85)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:1485)

环境信息

请填写以下信息:

  • OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
  • JDK信息: [e.g.:OpenJDK 64-Bit Server VM Zulu17.42+19-CA (build 17.0.7+7-LTS, mixed mode, sharing)]
  • 版本信息:[e.g.:Fastjson2 2.0.33]

使用:
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED
可暂时解决

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions