alibaba / alibaba/fastjson2

[BUG] actuator端点查看nacosdiscovery报错com.alibaba.fastjson2.JSONException: level too large : 2048

Open
#2,021 14 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

### 问题描述
*简要描述您碰到的问题。*
在访问http://localhost:8080/actuator/nacosdiscovery 的时候报错 HttpMessageNotWritableException: Could not write JSON: JSON#writeTo cannot serialize.
报错信息定位到com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter.writeInternal(FastJsonHttpMessageConverter.java:150)

但是打断点查看cause显示com.alibaba.fastjson2.JSONException: level too large : 2048

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

- OS信息: Windows10
- JDK信息: Openjdk 17.0.9
- 版本信息:Fastjson2 2.0.42

### 重现步骤
*如何操作可以重现该问题:*
astjson2.version为2.0.42
fastjson2-extension-spring6-version为2.0.42
fastjson2.adapter.version为2.0.26
spring-cloud-alibaba-version为2022.0.0.0
spring-boot-starter-actuator自动引入版本为3.0.2

在访问http://localhost:8080/actuator/nacosdiscovery 的时候报错 HttpMessageNotWritableException: Could not write JSON: JSON#writeTo cannot serialize.
报错信息定位到com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter.writeInternal(FastJsonHttpMessageConverter.java:150)

但是打断点查看cause显示com.alibaba.fastjson2.JSONException: level too large : 2048

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure at the /actuator/nacosdiscovery endpoint with the reported Fastjson2, Spring 6, Spring Boot, and Spring Cloud Alibaba versions. Inspect FastJsonHttpMessageConverter.writeInternal at the reported line and trace the response serialization; done means the endpoint serializes successfully and the failure is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.