alibaba / alibaba/fastjson2

[QUESTION]反序列化失败

Open
#1,345 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

调用JSON.parseObject、JSONObject.toJavaObject等方法统一提示如下信息,java类继承了Serializable,并且不论是否增加@JSONField注解,提示都是这个,其中使用的的JSONstring是从文件中读取的,fastjson1可以正常反序列化,网上也没找到类似的问题,请问这个问题要怎么处理
java.lang.UnsupportedOperationException: can't load this type of class file
at java.lang.ClassLoader.defineClass(ClassLoader.java:591)
at com.alibaba.fastjson2.util.DynamicClassLoader.defineClassPublic(DynamicClassLoader.java:138)
at com.alibaba.fastjson2.reader.ObjectReaderCreatorASM.createObjectReader(ObjectReaderCreatorASM.java:570)
at com.alibaba.fastjson2.reader.ObjectReaderProvider.getObjectReader(ObjectReaderProvider.java:808)
at com.alibaba.fastjson2.JSONObject.to(JSONObject.java:1195)
at com.alibaba.fastjson2.JSONObject.toJavaObject(JSONObject.java:1208)

Contributor guide

Open the contributing guide

Research direction

Start with the reported calls JSONObject.toJavaObject, JSONObject.to, and JSON.parseObject, then trace the stack through ObjectReaderProvider.getObjectReader, ObjectReaderCreatorASM.createObjectReader, and DynamicClassLoader.defineClassPublic. Reproduce the failure with the file-loaded JSON and the affected Java class, compare the fastjson1 behavior, and document a verified handling or fix for the unsupported class file error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.