dubbo调用发生StackOverflowError栈溢出异常

    昨天在工作中,dubbo抛出了一个bug——java.lang.StackOverflowError: null,具体的报错信息如下:

Caused by: java.lang.StackOverflowError: null
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:406)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:313)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:263)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:227)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:408)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:203)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:408)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:313)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:263)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:227)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:408)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:203)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:408)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:313)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:263)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:227)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:408)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:203)
	at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:408)
	at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:313)
	...
	...
	...

    当时看到这个错误的时候我真的是一脸懵,这个错误是我在调用别人的dubbo时抛出的,但抛出问题的部分明显是dubbo,看起来是因为无限循环或无限递归导致栈溢出。仔细一看,发现这应该是dubbo序列化出了问题,在序列化过程中出现了栈溢出,网上很多人说是dubbo传输的对象没有实现序列化接口,或者传输对象内部的某个属性类没有实现序列化接口,经过一番检查,这明显不是导致我这里报错的原因,最终发现是传输对象内部使用了JDK8的类——LocalDateTime,dubbo对java8的支持不是很好,将LocalDateTime换成了其他的类,问题果然解决了。mark一下,防止下次再遇到类似的问题

你可能感兴趣的:(JAVA日常)