alibaba / testable-mock

换种思路写Mock,让单元测试更简单
https://alibaba.github.io/testable-mock/
MIT License
1.83k stars 310 forks source link

在bamboo运行OmniConstructor.newInstance发现以下异常 #189

Closed wulihuawuqia closed 2 years ago

wulihuawuqia commented 3 years ago

Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.alibaba.testable.core.tool.OmniConstructor.createInstance(OmniConstructor.java:237) at com.alibaba.testable.core.tool.OmniConstructor.newObject(OmniConstructor.java:94) at com.alibaba.testable.core.tool.OmniConstructor.newInstance(OmniConstructor.java:76) ... 38 common frames omitted Caused by: java.lang.NoSuchMethodError: java.util.Date.(Ljava/lang/Void;)V at java.sql.Timestamp.(Timestamp.java) ... 45 common frames omitted

Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.alibaba.testable.core.tool.OmniConstructor.createInstance(OmniConstructor.java:237) at com.alibaba.testable.core.tool.OmniConstructor.newObject(OmniConstructor.java:94) at com.alibaba.testable.core.tool.OmniConstructor.newInstance(OmniConstructor.java:76) ... 38 more Caused by: java.lang.NoSuchMethodError: java.util.Date.(Ljava/lang/Void;)V at java.sql.Timestamp.(Timestamp.java) ... 45 more

wulihuawuqia commented 3 years ago

在本地iede无此问题,请问这种应该怎么解决呀?

linfan commented 2 years ago

单看错误堆栈,直接原因应该是在Bamboo上运行时,虚拟机中的java.util.Date类型绕过了TestableMock Agent的处理逻辑,导致其中缺少必要的方法,但在没有可复现环境的情况下,无法进行进一步排查。Issue先关闭。