Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 使用官方示例 FastJSON2最新版本 GraalVM Native Image编译失败 #2406

Closed
wssy001 opened this issue Apr 7, 2024 · 2 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@wssy001
Copy link

wssy001 commented Apr 7, 2024

环境信息

请填写以下信息:

  • OS信息: MacOS 14.4.1 With M3 Pro
  • JDK信息:Oracle GraalVM 23.1.2 For JDK 21
  • 版本信息:Fastjson2 2.0.48

重现步骤

  1. 下载官方示例源码
  2. 按照README.md进行编译

相关日志输出

➜  example-graalvm-native ./target/my-app 

Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.alibaba.fastjson2.JSONB.toBytes(JSONB.java:1057)
        at com.alibaba.fastjson2.writer.FieldWriter.<init>(FieldWriter.java:95)
        at com.alibaba.fastjson2.writer.FieldWriterObject.<init>(FieldWriterObject.java:47)
        at com.alibaba.fastjson2.writer.FieldWriterObjectFunc.<init>(FieldWriterObjectFunc.java:30)
        at com.alibaba.fastjson2.writer.ObjectWriterCreator.createFieldWriter(ObjectWriterCreator.java:1234)
        at com.alibaba.fastjson2.writer.ObjectWriterCreator.createFieldWriter(ObjectWriterCreator.java:1093)
        at com.alibaba.fastjson2.writer.ObjectWriterCreator.createFieldWriter(ObjectWriterCreator.java:1048)
        at com.alibaba.fastjson2.writer.ObjectWriters.fieldWriter(ObjectWriters.java:175)
        at com.alibaba.fastjson2.example.graalvm_native.App.registerReaderAndWriter(App.java:72)
        at com.alibaba.fastjson2.example.graalvm_native.App.main(App.java:46)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: com.alibaba.fastjson2.JSONException: init unsafe error
        at com.alibaba.fastjson2.util.JDKUtils.<clinit>(JDKUtils.java:89)
        ... 11 more

附加信息

Fastjson2 2.0.46 版本正常

➜  example-graalvm-native ./target/my-app

fastjson2 eishay toJSONString time : 1367
fastjson2 eishay toJSONString time : 1347
fastjson2 eishay toJSONString time : 1345
fastjson2 eishay toJSONString time : 1355
fastjson2 eishay toJSONString time : 1345
fastjson2 eishay parseObject time : 1195
fastjson2 eishay parseObject time : 1186
fastjson2 eishay parseObject time : 1184
fastjson2 eishay parseObject time : 1181
fastjson2 eishay parseObject time : 1181
@wssy001 wssy001 added the bug Something isn't working label Apr 7, 2024
@wenshao wenshao added this to the 2.0.49 milestone Apr 7, 2024
@wenshao wenshao added the fixed label Apr 7, 2024
@wenshao
Copy link
Member

wenshao commented Apr 7, 2024

是有问题,会在月底发布新版本修复

@wenshao
Copy link
Member

wenshao commented Apr 14, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.49
问题已修复,请用新版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants