dubbo serialization 配置为 fastjson2
调用Dubbo服务 内部异常之后 如空指针等 会报以下错误
com.alibaba.fastjson2.JSONException: fieldName not support input type TYPED_ANY -110, offset 51 at com.alibaba.fastjson2.JSONReaderJSONB.readFieldNameHashCode(JSONReaderJSONB.java:1302) at com.alibaba.fastjson2.reader.ObjectReaderException.readObject(ObjectReaderException.java:143) at com.alibaba.fastjson2.reader.ObjectReaderException.readJSONBObject(ObjectReaderException.java:360) at com.alibaba.fastjson2.JSONReaderJSONB.read(JSONReaderJSONB.java:217) at com.alibaba.fastjson2.reader.ObjectReaderException.readObject(ObjectReaderException.java:172) at com.alibaba.fastjson2.reader.ObjectReaderException.readJSONBObject(ObjectReaderException.java:360) at com.alibaba.fastjson2.JSONB.parseObject(JSONB.java:518) at org.apache.dubbo.common.serialize.fastjson2.FastJson2ObjectInput.readObject(FastJson2ObjectInput.java:116) at org.apache.dubbo.common.serialize.fastjson2.FastJson2ObjectInput.readObject(FastJson2ObjectInput.java:102)
报错时 JSONB.toJSONString(bytes) 信息 { "@type":"vip.joinsun.exception.ServiceException", "cause":{ "@type":"vip.joinsun.exception.BusinessException", "message":"分布式事务下的本地事务测试抛错回滚", "stackTrace":[ { "fileName":"RefreshServiceImpl.java", "lineNumber":1341, "className":"vip.joinsun.service.refresh.RefreshServiceImpl", "methodName":"doTestGts" }, { "fileName":"", "lineNumber":-1, "className":"vip.joinsun.service.refresh.RefreshServiceImpl$$FastClassBySpringCGLIB$$d10e8883", "methodName":"invoke" }, { "fileName":"MethodProxy.java", "lineNumber":218, "className":"org.springframework.cglib.proxy.MethodProxy", "methodName":"invoke" }, { "fileName":"CglibAopProxy.java", "lineNumber":793, "className":"org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation", "methodName":"invokeJoinpoint" }, { "fileName":"ReflectiveMethodInvocation.java", "lineNumber":163, "className":"org.springframework.aop.framework.ReflectiveMethodInvocation", "methodName":"proceed" }, { "fileName":"CglibAopProxy.java", "lineNumber":763, "className":"org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation", "methodName":"proceed" }, { "fileName":"TransactionInterceptor.java", "lineNumber":123, "className":"org.springframework.transaction.interceptor.TransactionInterceptor$1", "methodName":"proceedWithInvocation" }, { "fileName":"TransactionAspectSupport.java", "lineNumber":388, "className":"org.springframework.transaction.interceptor.TransactionAspectSupport", "methodName":"invokeWithinTransaction" }, { "fileName":"TransactionInterceptor.java", "lineNumber":119, "className":"org.springframework.transaction.interceptor.TransactionInterceptor", "methodName":"invoke" }, { "fileName":"ReflectiveMethodInvocation.java", "lineNumber":186, "className":"org.springframework.aop.framework.ReflectiveMethodInvocation", "methodName":"proceed" }, { "fileName":"CglibAopProxy.java", "lineNumber":763, "className":"org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation", "methodName":"proceed" }, { "fileName":"GlobalTransactionalInterceptor.java", "lineNumber":204, "className":"io.seata.spring.annotation.GlobalTransactionalInterceptor$2", "methodName":"execute" }, { "fileName":"TransactionalTemplate.java", "lineNumber":130, "className":"io.seata.tm.api.TransactionalTemplate", "methodName":"execute" }, { "fileName":"GlobalTransactionalInterceptor.java", "lineNumber":201, "className":"io.seata.spring.annotation.GlobalTransactionalInterceptor", "methodName":"handleGlobalTransaction" }, { "fileName":"GlobalTransactionalInterceptor.java", "lineNumber":171, "className":"io.seata.spring.annotation.GlobalTransactionalInterceptor", "methodName":"invoke" }, { "fileName":"ReflectiveMethodInvocation.java", "lineNumber":186, "className":"org.springframework.aop.framework.ReflectiveMethodInvocation", "methodName":"proceed" }, { "fileName":"CglibAopProxy.java", "lineNumber":763, "className":"org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation", "methodName":"proceed" }, { "fileName":"ExposeInvocationInterceptor.java", "lineNumber":97, "className":"org.springframework.aop.interceptor.ExposeInvocationInterceptor", "methodName":"invoke" }, { "fileName":"ReflectiveMethodInvocation.java", "lineNumber":186, "className":"org.springframework.aop.framework.ReflectiveMethodInvocation", "methodName":"proceed" }, { "fileName":"CglibAopProxy.java", "lineNumber":763, "className":"org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation", "methodName":"proceed" }, { "fileName":"CustomGlobalTransactionalInterceptor.java", "lineNumber":24, "className":"com.joinsun.aop.CustomGlobalTransactionalInterceptor", "methodName":"invoke" }, { "fileName":"ReflectiveMethodInvocation.java", "lineNumber":186, "className":"org.springframework.aop.framework.ReflectiveMethodInvocation", "methodName":"proceed" }, { "fileName":"CglibAopProxy.java", "lineNumber":763, "className":"org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation", "methodName":"proceed" }, { "fileName":"CglibAopProxy.java", "lineNumber":708, "className":"org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", "methodName":"intercept" }, { "fileName":"", "lineNumber":-1, "className":"vip.joinsun.service.refresh.RefreshServiceImpl$$EnhancerBySpringCGLIB$$dc028d6a", "methodName":"doTestGts" }, { "fileName":"RefreshServiceDubboWrap171.java", "lineNumber":-1, "className":"vip.joinsun.service.refresh.RefreshServiceDubboWrap171", "methodName":"invokeMethod" }, { "fileName":"JavassistProxyFactory.java", "lineNumber":73, "className":"org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1", "methodName":"doInvoke" }, { "fileName":"AbstractProxyInvoker.java", "lineNumber":100, "className":"org.apache.dubbo.rpc.proxy.AbstractProxyInvoker", "methodName":"invoke" }, { "fileName":"DelegateProviderMetaDataInvoker.java", "lineNumber":55, "className":"org.apache.dubbo.config.invoker.DelegateProviderMetaDataInvoker", "methodName":"invoke" }, { "fileName":"InvokerWrapper.java", "lineNumber":56, "className":"org.apache.dubbo.rpc.protocol.InvokerWrapper", "methodName":"invoke" }, { "fileName":"ClassLoaderCallbackFilter.java", "lineNumber":38, "className":"org.apache.dubbo.rpc.filter.ClassLoaderCallbackFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"Invoker.java", "lineNumber":55, "className":"com.alibaba.dubbo.rpc.Invoker$CompatibleInvoker", "methodName":"invoke" }, { "fileName":"AlibabaDubboTransactionPropagationFilter.java", "lineNumber":45, "className":"io.seata.integration.dubbo.alibaba.AlibabaDubboTransactionPropagationFilter", "methodName":"invoke" }, { "fileName":"Filter.java", "lineNumber":29, "className":"com.alibaba.dubbo.rpc.Filter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"TraceFilter.java", "lineNumber":79, "className":"org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"TimeoutFilter.java", "lineNumber":44, "className":"org.apache.dubbo.rpc.filter.TimeoutFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"SeataTransactionPropagationProviderFilter.java", "lineNumber":66, "className":"org.apache.dubbo.seata.SeataTransactionPropagationProviderFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"MonitorFilter.java", "lineNumber":100, "className":"org.apache.dubbo.monitor.support.MonitorFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"DubboExceptionFilter.java", "lineNumber":33, "className":"vip.joinsun.filter.DubboExceptionFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"GenericFilter.java", "lineNumber":192, "className":"org.apache.dubbo.rpc.filter.GenericFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"ClassLoaderFilter.java", "lineNumber":54, "className":"org.apache.dubbo.rpc.filter.ClassLoaderFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"EchoFilter.java", "lineNumber":41, "className":"org.apache.dubbo.rpc.filter.EchoFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"ProfilerServerFilter.java", "lineNumber":58, "className":"org.apache.dubbo.rpc.filter.ProfilerServerFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"ContextFilter.java", "lineNumber":133, "className":"org.apache.dubbo.rpc.filter.ContextFilter", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":327, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode", "methodName":"invoke" }, { "fileName":"FilterChainBuilder.java", "lineNumber":194, "className":"org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CallbackRegistrationInvoker", "methodName":"invoke" }, { "fileName":"DubboProtocol.java", "lineNumber":156, "className":"org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1", "methodName":"reply" }, { "fileName":"HeaderExchangeHandler.java", "lineNumber":102, "className":"org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler", "methodName":"handleRequest" }, { "fileName":"HeaderExchangeHandler.java", "lineNumber":177, "className":"org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler", "methodName":"received" }, { "fileName":"DecodeHandler.java", "lineNumber":53, "className":"org.apache.dubbo.remoting.transport.DecodeHandler", "methodName":"received" }, { "fileName":"ChannelEventRunnable.java", "lineNumber":62, "className":"org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable", "methodName":"run" }, { "fileName":"ThreadPoolExecutor.java", "lineNumber":1149, "className":"java.util.concurrent.ThreadPoolExecutor", "methodName":"runWorker" }, { "fileName":"ThreadPoolExecutor.java", "lineNumber":624, "className":"java.util.concurrent.ThreadPoolExecutor$Worker", "methodName":"run" }, { "fileName":"InternalRunnable.java", "lineNumber":41, "className":"org.apache.dubbo.common.threadlocal.InternalRunnable", "methodName":"run" }, { "fileName":"Thread.java", "lineNumber":748, "className":"java.lang.Thread", "methodName":"run" } ], "suppressedExceptions":{ "@type":"java.util.Collections$UnmodifiableRandomAccessList", "https://github.com/value":[] } },
"detailMessage":"vip.joinsun.exception.BusinessException: 分布式事务下的本地事务测试抛错回滚",
"stackTrace":[], "suppressedExceptions":{"$ref":"$.cause.suppressedExceptions"} }
原提问者GitHub用户HelloToGithub
问题已修复,请用新版本 https://github.com/alibaba/fastjson2/releases/tag/2.0.25
原回答者GitHub用户wenshao
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。