org.springframework.cglib.core.ReflectUtils $ 1的非法反射访问 [英] Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1

查看:230
本文介绍了org.springframework.cglib.core.ReflectUtils $ 1的非法反射访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的JDK 9 + 181 Spring Boot 2.0.0.BUILD-SNAPSHOT CLI应用程序在启动时显示此警告:

 警告:发生了非法的反射访问操作
警告:org.springframework.cglib.core.ReflectUtils $ 1的非法反射访问(jar:file:/ home / jan / src / fm-cli / target / fm-cli- 0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.0.0.RELEASE.jar!/)方法java.lang.ClassLoader.defineClass(java.lang.String,byte [],int ,int,java.security.ProtectionDomain)
警告:请考虑向org.springframework.cglib.core.ReflectUtils $ 1


这是一个控制台应用程序,所以我需要禁用此警告 - 我该怎么做?



注意:此问题询问如何禁用Spring触发此警告的具体问题;它不是 JDK9的副本:发生了非法反射访问操作。 org.python.core.PySystemState 处理不同库中的类似症状。

解决方案

在JDK 9中+,将以下选项添加到JVM以禁用Spring使用CGLIB的警告:

   -  add-opens java。 base / java.lang = ALL-UNNAMED 

例如:

  java --add-opens java.base / java.lang = ALL-UNNAMED -jar target / * .jar 

无需报告;这是一个已知的Spring bug



这是因为新的JDK 9模块系统检测到非法访问,将来(近)将被禁止访问。您可以阅读有关的更多信息这里的JDK 9模块系统



更新



对于这个问题的解决方案是JDK 9+和Spring 5.1 +。


My JDK 9+181 Spring Boot 2.0.0.BUILD-SNAPSHOT CLI application displays this warning on startup:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/home/jan/src/fm-cli/target/fm-cli-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.0.0.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1

This is a console application, so I need to disable this warning -- how can I do that?

Note: This question asks the specific question of how to disable this warning triggered by Spring; it is not a duplicate of JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState which deals with a similar symptom in a different library.

解决方案

In JDK 9+, add the following option to the JVM to disable the warning from Spring's use of CGLIB:

--add-opens java.base/java.lang=ALL-UNNAMED

for example:

java --add-opens java.base/java.lang=ALL-UNNAMED -jar target/*.jar

No need to report it; it's a known Spring bug.

This happens because the new JDK 9 module system detected an illegal access that will be disallowed sometime in the (near) future. You can read more about the JDK 9 Module system here.

Update:

A fix for this issue is available JDK 9+ with Spring 5.1+.

这篇关于org.springframework.cglib.core.ReflectUtils $ 1的非法反射访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆