I am using fastjson without importing the
maven dubbo-serialization-fastjson pom. Seems like it is included in Dubbo.
My consumer url is
:
reference.setUrl("dubbo://"+vpsIp+":20880/"+interfaceName+"?token=1234567&serialization=fastjson");
So as you can see i put the serialization directly in the URL because i
didn't find a way to configure it in java. (if you can help on this...)
"I think the the exception happened on the provider side when trying to
deserialize raw json data to java bean."
That's exactly what is happening.
"FastjsonObjectInput#readObject(Class<T> cls, Type type)"
This method is never called. The called method is "public <T> T
readObject(Class<T> cls)"
here is some screenshots to show you what is happening :
https://i.imgur.com/VAdQKlt.png
https://i.imgur.com/5su4FsJ.png
and finally when the error happen : https://i.imgur.com/66zfbUi.png
So yes it seems like when using fastjson it got a Map of JSONObject instead
of a List of OperatingSystemVersion.
If i remove from the consumer url the param serialization=fastjson
everything work fine.
Le jeu. 14 avr. 2022 à 15:11, Jun Liu <[email protected]> a écrit :
> Are you using fastjson as the default serialization protocol there? Say by
> using ‘dubbo-serialization-fastjson’?
>
> I think the the exception happened on the provider side when trying to
> deserialize raw json data to java bean. Would you please set a breakpoint
> at the following place to try to debug and see the exact type of the second
> argument ’type’?
>
> FastjsonObjectInput#readObject(Class<T> cls, Type type)
>
> I guess it’s because the autoType feature has been disabled in the latest
> several fastjson releases for security reasons.
>
> Jun
>
> > On Apr 8, 2022, at 11:20 PM, Daniel SAWAN <[email protected]> wrote:
> >
> > client side error :
> > Caused by: org.apache.dubbo.remoting.RemotingException:
> > com.alibaba.fastjson.JSONException: autoType is not support.
> > java.lang.ClassCastException
> >
> > Seems like instead of sending a List<User> dubbo client is sending a
> > List<JSONObject> to Dubbo server.
>
>