一、报错内容 在 install Maven项目时,控制台出现警告如下: WARNING: An illegal reflective access operation has occurredWAR
WARNING: An illegal reflective access operation has occurredWARNING: Illegal reflective access by org.apache.flink.api.java.ClosureCleaner (file:/D:/Users/xxx/.m2/repository/org/apache/flink/flink-core/1.12.0/flink-core-1.12.0.jar) to field java.util.Properties.serialVersionUIDWARNING: Please consider reporting this to the maintainers of org.apache.flink.api.java.ClosureCleanerWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operationsWARNING: All illegal access operations will be denied in a future release
字面意思说的是发生的了一个非法的反射访问操作,在jdk 9之前 ,Java允许通过反射机制访问所有的成员,这些成员的类型包括私有(private),公共(public),包(< package >)和受保护(protected)。
JDK9新增了模块系统之后, 对反射行为做出了一定的限制。即对于非公有的成员、成员方法和构造方法,模块不能通过反射直接去访问,但是JDK9提供了一个可选的修饰符open来声明一个开放模块,可以从一个开放模块中导出所有的包,以便在运行时对该模块中的所有包中的所有类型进行深层反射来访问。
在JDK9中,Java运行时由一个一个的模块组成。基于旧版本JDK开发的第三方jar包在迁移到JDK9时无法被转换成为模块,但是可以将其放在类路径下,被加载成为一个unnamed标识的模块,如果该模块存在被使用的需求,则会被放置在模块路径上,被加载后用作自动模块,进而被系统依赖使用。
将JDK切换成旧版本的即可。
(我这里使用的是JDK11出现了这个问题,将JDK11降级成JDK8之后警告就消失了)
<properties> <maven.compiler.source>8maven.compiler.source> <maven.compiler.target>8maven.compiler.target>properties>
【异常】An illegal reflective access operation has occurred警告
An illegal reflective access operation has occurred警告
来源地址:https://blog.csdn.net/wstever/article/details/129680130
--结束END--
本文标题: 【异常】IDEA提示An illegal reflective access operation has occurred警告
本文链接: https://www.lsjlt.com/news/390174.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-03
2024-04-03
2024-04-01
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0