极客先躯
2022-06-23 18:17
采纳率: 38.5%
浏览 11

fastjson 序列化异常问题?

问题遇到的现象和发生背景

在代码中使用: JSON.toJSONString(infCrmRequest) 方法的时候出现如下问题, 导致堆栈溢出

问题相关代码,请勿粘贴截图

2022-06-23 18:13:18.282 ERROR 29710 --- [http-nio-9882-exec-1] org.apache.juli.logging.DirectJDKLog.log (DirectJDKLog.java:182) : Servlet.service() for servlet [dispatcherServlet] in context with path [/IOM-CLOUD-INF-SERVICE] threw exception [Request processing failed; nested exception is java.lang.reflect.InvocationTargetException] with root cause

java.lang.StackOverflowError: null
    at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:72)
    at sun.reflect.GeneratedMethodAccessor214.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.setThreadCallbacks(Enhancer.java:461)
    at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.newInstance(Enhancer.java:441)
    at org.springframework.cglib.proxy.Enhancer.nextInstance(Enhancer.java:700)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:295)
    at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:480)
    at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:305)
    at com.ztesoft.iom.common.transaction.TxEntityProxy.createProxyObject(TxEntityProxy.java:30)
    at com.ztesoft.iom.utils.helper.jdbc.entity.BaseEntity.getProxyEntity(BaseEntity.java:84)
    at sun.reflect.GeneratedMethodAccessor235.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.ztesoft.iom.common.transaction.TxEntityProxy.intercept(TxEntityProxy.java:108)
    at com.ztesoft.iom.business.inf.crmRequest.dto.InfCrmRequest$$EnhancerByCGLIB$$3ffa94ef.getProxyEntity(<generated>)
    at com.alibaba.fastjson.serializer.ASMSerializer_1_InfCrmRequest.write(Unknown Source)
    at com.alibaba.fastjson.serializer.JSONSerializer.writeWithFieldName(JSONSerializer.java:333)
    at com.alibaba.fastjson.serializer.ASMSerializer_1_InfCrmRequest.write(Unknown Source)
    at com.alibaba.fastjson.serializer.JSONSerializer.writeWithFieldName(JSONSerializer.java:333)
    at com.alibaba.fastjson.serializer.ASMSerializer_1_InfCrmRequest.write(Unknown Source)
    at com.alibaba.fastjson.serializer.JSONSerializer.writeWithFieldName(JSONSerializer.java:333)
    at com.alibaba.fastjson.serializer.ASMSerializer_1_InfCrmRequest.write(Unknown Source)
    at com.alibaba.fastjson.serializer.JSONSerializer.writeWithFieldName(JSONSerializer.java:333)
    at com.alibaba.fastjson.serializer.ASMSerializer_1_InfCrmRequest.write(Unknown Source)
    at com.alibaba.fastjson.serializer.JSONSerializer.writeWithFieldName(JSONSerializer.java:333)
    at com.alibaba.fastjson.serializer.ASMSerializer_1_InfCrmRequest.write(Unknown Source)
    at com.alibaba.fastjson.serializer.JSONSerializer.writeWithFieldName(JSONSerializer.java:333)

运行结果及报错内容
我的解答思路和尝试过的方法

有遇到类似问题的小伙伴没, 帮忙解答一下具体的问题是什么引起的

我想要达到的结果
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题