【问题标题】:cannot access class org.springframework.cglib.core.ReflectUtils with java 17 ! How to open a package of unknown module?无法使用 java 17 访问类 org.springframework.cglib.core.ReflectUtils!如何打开未知模块包?
【发布时间】:2023-01-28 04:23:36
【问题描述】:
我想将 spring(spring boot 2.7.3) 与 java17 上的 JavaFx 应用程序实现集成,我遇到了以下问题;
class com.XXX$$EnhancerBySpringCGLIB$$637d19c4 (in module com.xxx) cannot access class
org.springframework.cglib.core.ReflectUtils (in unnamed module @0x2d950574) because module
com.xxx does not read unnamed module @0x2d950574
任何帮助?
【问题讨论】:
标签:
spring
spring-boot
java-17
【解决方案1】:
尝试添加一个虚拟机参数--add-modules=ALL-SYSTEM
如果它工作正常,则您可以仅指定引发问题的模块。
【解决方案2】:
尝试添加 JVM 参数 --add-reads=com.xxx=ALL-UNNAMED
【解决方案3】:
在 Java 19 上,我也遇到了类似的问题:
(in module com.xxx) cannot access class org.springframework.cglib.core.ReflectUtils (in unnamed module @0x2d950574) because module com.xxx does not read unnamed module @0x2d950574
请查看上面消息中的module com.xxx。作为解决方案,您可以添加 VM 参数:
--add-reads com.xxx=ALL-UNNAMED