开发者社区 > 云原生 > 正文

dubbo支持JDK17的问题--add-opens

接口调用时异常

版本情况

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

展开
收起
大圣东游 2023-05-11 15:47:20 490 0
1 条回答
写回答
取消 提交回答
  • JDK 17 需要 3.2.0 版本才能原生支持。3.1.x 版本可以配置序列化方式为 fastjson2 支持

    原回答者GitHub用户AlbumenJ

    2023-05-12 10:16:37
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

热门讨论

热门文章

相关电子书

更多
Dubbo开源现状与2.7规划 立即下载
Dubbo分布式服务治理实战 立即下载
《Dubbo 3.0 前瞻》 立即下载