接口调用时异常
版本情况
JDK版本: Alibaba_Dragonwell_Standard_17.0.6.0.6.9_x64_linux dubbo-spring-boot-starter:3.1.7 dubbo版本: 3.1.7 spring-boot:2.7.9
问题描述
1、复现代码
OrderShopAppClient.shopEmpTicketMoneySum(dataStatReqDTO.getEmpCode() , dataStatReqDTO.getStartTime(), dataStatReqDTO.getEndTime());
调用以上接口时在消费端报出异常
dataStatReqDTO:
private Date startTime;
private Date endTime;
JDK已添加配置
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/sun.util=ALL-UNNAMED -jar -Dspring.profiles.active=dev /xxxx.jar
2、堆栈信息
cause: org.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: java.lang.RuntimeException: Unable to make field private int sun.util.calendar.ZoneInfo.rawOffset accessible: module java.base does not "opens sun.util.calendar" to unnamed module @2b80d80f Java field: private java.util.TimeZone cn.hutool.core.date.DateTime.timeZone io.netty.handler.codec.EncoderException: java.lang.RuntimeException: Unable to make field private int sun.util.calendar.ZoneInfo.rawOffset accessible: module java.base does not "opens sun.util.calendar" to unnamed module @2b80d80f Java field: private java.util.TimeZone cn.hutool.core.date.DateTime.timeZone at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:304) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115) at org.apache.dubbo.remoting.transport.netty4.NettyClientHandler.write(NettyClientHandler.java:88) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879) at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940) at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1247) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.RuntimeException: Unable to make field private int sun.util.calendar.ZoneInfo.rawOffset accessible: module java.base does not "opens sun.util.calendar" to unnamed module @2b80d80f Java field: private java.util.TimeZone cn.hutool.core.date.DateTime.timeZone
原提问者GitHub用户Skqing
JDK 17 需要 3.2.0 版本才能原生支持。3.1.x 版本可以配置序列化方式为 fastjson2 支持
原回答者GitHub用户AlbumenJ
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。