dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] com.alibaba.fastjson2.JSONException: not support autotype : [String, offset 10

Open 390237 opened this issue 10 months ago • 3 comments

Pre-check

  • [X] I am sure that all the content I provide is in English.

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo java 3,2.11 jdk1.8

Steps to reproduce this issue

When using the default fastjson2, if the interface contains a parameter that is: String[], the error is returned: com.alibaba.fastjson2.JSONException: not support autotype : [String, offset 10, When the production side is changed to Hessian2, it can be used normally, and fastjson2 can support the String[] parameter?

当使用默认fastjson2,接口如果包含有参数是:String[],返回错误:com.alibaba.fastjson2.JSONException: not support autotype : [String, offset 10, 当将生产端改成Hessian2,就可以正常使用,可以让fastjson2支持String[]参数?

What you expected to happen

Can fastjson2 support String[]?

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [ ] Yes I am willing to submit a pull request on my own!

Code of Conduct

390237 avatar Apr 16 '24 12:04 390237

这也许是fastjson的问题而不是dubbo的问题

heliang666s avatar Apr 19 '24 13:04 heliang666s

这也许是fastjson2的问题,而不是dubbo的问题

是fastjson2的问题。

Dubbo3.2默认使用fastjson2,升级过程中遇到一些fastjson2参数序列化问题。出于安全风险考虑,最终选择退回到hessian2,升级所有核心应用到生产环境的目标才完成。 建议统一使用hessian2参数序列化,与先前保持一样,因为有很多奇葩的响应返回结构。 @390237

fastjson2当前还不是很稳定,遇到的问题不少,参数序列化的性能收益也较低。

Dubbo应用可观测性升级指南与踩坑记录 https://blog.csdn.net/shupili141005/article/details/137884052

bert82503 avatar Apr 22 '24 05:04 bert82503

嗯,已经指定使用hessian2了,主要觉得dubbo在fastjson2还没完全稳定情况下,将默认序列化强制成fastjson2,太冒险了。

390237 avatar Apr 28 '24 12:04 390237

hessian2 在高版本的jdk下也有问题https://github.com/apache/dubbo/issues/14259 不过现在dubbo默认序列化就是hessian2呀

Please close this pr as completed

wcy666103 avatar Jun 05 '24 05:06 wcy666103

hessian2 在高版本的jdk下也有问题#14259 不过现在dubbo默认序列化就是hessian2呀

Please close this pr as completed

尝试策略回退,也是不得已而为之,说明此变更对用户使用体验不是很好 😄 #13974

bert82503 avatar Jun 05 '24 05:06 bert82503