alibaba / alibaba/fastjson2

类型转换异常

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

Description

### 问题描述
*spring-devtools与fastjson2 同时使用出现类型转换异常*

### 环境信息
*请填写以下信息:*

- OS信息: Windows11
- JDK信息: openjdk version "17.0.6"
- 版本信息:Fastjson2 2.0.28

### 重现步骤
在springboot项目中使用devtools, 以及使用 vertx的 eventbus 发送和接收消息,数据编解码均是 Fastjson2, 生产者发送后,接收者接收时需要通过 jsonObject 转换成具体的消息类型,出现类型转换异常
```java
//可在此输入示例代码
```

### 期待的正确结果
能够正常转换

### 相关日志输出
class xxxxx.event.EventData cannot be cast to class xxxxx.event.EventData (xxxxxx.event.EventData is in unnamed module of loader 'app'; xxxxxx.event.EventData is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @55196a24)

#### 附加信息

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in a Spring Boot project using spring-devtools, Vert.x EventBus, and Fastjson2 for message encoding and decoding. Inspect the class-loader boundary during JSONObject conversion to EventData; done means the received message converts without a ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
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.