家人们,踩坑啊,如果是jdk8之后的版本,JDK 8 中有关反射相关的功能自从 JDK 9 开始就已经被限制了,为了兼容原先的版本,需要在运行项目时添加 --add-opens java.base/java.lang=ALL-UNNAMED 选项来开启这种默认不被允许的行为,在那个VM options里,具体的报错信息如下:

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @595b007d

相关课程:JAVA 全系列>第二十一阶段:Spring Cloud Alibaba技术栈>Spring Cloud Alibaba>服务调用_Dubbo实现服务生产者

©2014-2023 百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备13018289号-12    营业执照    经营许可证:京B2-20212637