-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG]JDK17 序列化异常 #2437
Comments
rebuild一下项目就好了,我没法复现... 只能简单试了一下,好像没啥问题 public static void main(String[] args) throws IOException {
Bean bean = new Bean();
byte[] bytes = JSONB.toBytes(bean, JSONWriter.Feature.WriteClassName,
JSONWriter.Feature.FieldBased,
JSONWriter.Feature.ReferenceDetection,
JSONWriter.Feature.WriteNulls,
JSONWriter.Feature.NotWriteDefaultValue,
JSONWriter.Feature.NotWriteHashMapArrayListClassName,
JSONWriter.Feature.WriteNameAsSymbol);
System.out.println(Objects.nonNull(bytes));
Bean bean1 = JSONB.parseObject(bytes, Bean.class,
JSONReader.Feature.UseDefaultConstructorAsPossible,
JSONReader.Feature.UseNativeObject,
JSONReader.Feature.IgnoreAutoTypeNotMatch,
JSONReader.Feature.FieldBased);
System.out.println(bean1.lock);
}
public static class Bean {
public Lock lock = new ReentrantLock();
} 2.0.43版本测试情况:
2.0.49版本测试情况:
|
如果 public static void main(String[] args) throws IOException {
Bean bean = new Bean();
bean.lock = new ReentrantLock();
bean.lock.lock();
byte[] bytes = JSONB.toBytes(bean, JSONWriter.Feature.WriteClassName,
JSONWriter.Feature.FieldBased,
JSONWriter.Feature.ReferenceDetection,
JSONWriter.Feature.WriteNulls,
JSONWriter.Feature.NotWriteDefaultValue,
JSONWriter.Feature.NotWriteHashMapArrayListClassName,
JSONWriter.Feature.WriteNameAsSymbol);
System.out.println(Objects.nonNull(bytes));
Bean bean1 = JSONB.parseObject(bytes, Bean.class,
JSONReader.Feature.UseDefaultConstructorAsPossible,
JSONReader.Feature.UseNativeObject,
JSONReader.Feature.IgnoreAutoTypeNotMatch,
JSONReader.Feature.FieldBased);
System.out.println(bean1.lock);
}
public static class Bean {
public Lock lock;
} 测试结果:
|
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
问题描述
java.lang.IllegalAccessError: failed to access class java.util.concurrent.locks.ReentrantLock$Sync from class com.alibaba.fastjson2.writer.OWG_23_1_ReentrantLock (java.util.concurrent.locks.ReentrantLock$Sync is in module java.base of loader 'bootstrap'; com.alibaba.fastjson2.writer.OWG_23_1_ReentrantLock is in unnamed module of loader com.alibaba.fastjson2.util.DynamicClassLoader @38a01810)
at com.alibaba.fastjson2.writer.OWG_23_1_ReentrantLock.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.FieldWriterObject.write(FieldWriterObject.java:379)
at com.alibaba.fastjson2.writer.ObjectWriterAdapter.writeJSONB(ObjectWriterAdapter.java:205)
at com.alibaba.fastjson2.writer.OWG_22_6_ItemDataSource.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.ObjectWriterImplMap.writeJSONB(ObjectWriterImplMap.java:362)
at com.alibaba.fastjson2.writer.OWG_21_9_DynamicRoutingDataSource.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_20_3_Environment.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_19_53_Configuration.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_18_1_DefaultSqlSessionFactory.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_17_3_SqlSessionTemplate.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_16_3_MapperProxy.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_15_1_$Proxy211.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_14_2_SysDeptServiceImpl.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.writer.OWG_13_1_OrganizationDataAscriptionCustomDataScope.writeJSONB(Unknown Source)
at com.alibaba.fastjson2.JSONB.toBytes(JSONB.java:1225)
at org.apache.dubbo.common.serialize.fastjson2.FastJson2ObjectOutput.writeObject(FastJson2ObjectOutput.java:115)
环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:使用dubbo 3.2.7版本出现的
The text was updated successfully, but these errors were encountered: