Spring-framework: on JDK 11 - WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/C:/Users/.../spring-core/4.3.22.RELEASE/spring-core-4.3.22.RELEASE.jar)

Created on 26 Mar 2019  路  45Comments  路  Source: spring-projects/spring-framework

Error for Spring Boot 1.5.x (1.5.19.RELEASE, using the latest spring-core-4.3.22.RELEASE.jar)

I have not seen this error before within previous boot 1.5.17.RELEASE.
And frankly upgrade to the latest 1.5.19.RELEASE/spring-core-4.3.22.RELEASE.jar was maybe 1-2 weeks ago.

So why this error appeared?

14:43:23.388 [main] INFO  o.s.b.f.s.DefaultListableBeanFactory#registerBeanDefinition:826 - Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/C:/Users/myuserlogin/.m2/repository/org/springframework/spring-core/4.3.22.RELEASE/spring-core-4.3.22.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
14:43:25.687 [main] INFO  o.s.b.f.a.AutowiredAnnotationBeanPostProcessor#<init>:155 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring

image

ref https://github.com/spring-projects/spring-framework/issues/22019

core

Most helpful comment

@cy503328434
I am getting the same warning on OS Windows 10, jdk-11.0.2, Spring boot 2.2.1,spring-core/5.2.1.RELEASE!

All 45 comments

This is just a warning that appears on JDK 9+, caused by the use of internal JDK API in CGLIB. You may safely ignore this for the time being; a Spring Framework 4.3 based application will nevertheless run fine.

For full JDK 9+ support, please upgrade to Spring Framework 5.1+ / Spring Boot 2.1+.

This warning has been on JDK 8 u201

Seriously, on a recent JDK 8 update? Could you please double-check that? This is only known to appear on JDK 9+ against the new module system foundation there.

In any case, those warnings will only disappear as of Spring Framework 5.1+. The alternative way of defining classes on JDK 9+ is quite involved and comes with side effects, so we are not going to backport it. With 4.3.x and 5.0.x, it's safe to ignore those warnings anyway, as far as we're aware.

OK, I will do java -version at work....

D:\Workspaces\Projectname>java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

OS Windows 10

@paulvi java -version is not a proof that the process you are running is using that version.

Indeed, my wrong:

while a have Java 8 on path, and have been using it for all projects,
my IDE chose JDK 11, when I was reimporting code into IDE yesterday, and I just noticed this.

The good news is that after using JDK 11 for a day, I have not noticed any other issues.

@paulvi, thanks for the feedback.

OS Windows 10, jdk-11.0.5, Spring boot 2.2.1,spring-core/5.2.1.RELEASE, I noticed stille has:WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/E:/dev/gradle/repository/caches/modules-2/files-2.1/org.springframework/spring-core/5.2.1.RELEASE/32b265ff5c7c35257b5a242b9628dcd321a2b010/spring-core-5.2.1.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

@cy503328434
I am getting the same warning on OS Windows 10, jdk-11.0.2, Spring boot 2.2.1,spring-core/5.2.1.RELEASE!

I am experiencing this warning on MacOS Catalina, oracle JDK11, spring 5.1.6 and spring boot 2.1.10
Can you please inform me of a solution (not the mentioned work around of --add jvm option as mention in stackoverflow)

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file://org/springframework/spring-core/5.2.2.RELEASE/spring-core-5.2.2.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

I'm getting the same on spring-core-5.1.10 with jdk 11. This should be reopened.

same warning on openjdk64-11.0.2, spring-core-5.2.2.RELEASE.jar, spring boot 2.2.2.RELEASE

Same issue Windows 10, jdk-11.0.3, spring-boot 2.0.6.Release, spring-core 5.0.10.RELEASE

Same Issue Windows 10 Prof., openjdk-12.0.2, spring-boot 2.1.4, openjfx 13

Same, Mac OS Mojave . openjdk 11.0.6 2020-01-14. spring boot 2.2.4.RELEASE

Same here (Spring Boot 2.2.4, OpenJDK 11, Alpine):
Illegal reflective access by org.springframework.cglib.core.ReflectUtils (jar:file:...jar!/BOOT-INF/lib/spring-core-5.2.3.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

How many repeated reports are necessary to re-open the error, @jhoeller?
This is No. 10 (with about 20 likes all-in-all in the last 3 months).
Should we raise a new issue?

Same on Windows 10 with Oracle JDK 11.0.6 LTS

 Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:cC/<user-dir>/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.2.3.RELEASE/3734223040040e8c3fecd5faa3ae8a1ed6da146b/spring-core-5.2.3.RELEASE.jar
) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

Everyone, sharing the warning is not very useful unfortunately as the warning alone is no indication that it is the same problem. Please review this comment.

Please note that this warning can still happen on Spring Framework 5.1+ in case of certain ClassLoader scenarios and certain kinds of application classes to be proxied. The root of the problem is that there is no full replacement for the (non-public) ClassLoader.defineClass mechanism in JDK 9+ since Lookup.defineClass does not allow for specifying the ClassLoader to define the class in (it rather always uses the ClassLoader of the given context class). For that reason, we have to keep using ClassLoader.defineClass in case of custom ClassLoader architectures such as OSGi, some Java EE scenarios, and also DevTools reloading. Some occurrences of that warning are therefore totally expected; we only 麓fixed麓 the case that we can actually address with the replacement API.

As for the warning itself, as St茅phane mentioned, unfortunately it only indicates that Spring's CGLIB variant has been used for creating a class in a specific ClassLoader where ClassLoader.defineClass still has to be used. What we really need to know about is the particular class that triggered the warning, the ClassLoader architecture in use, and the code path that led to the creation attempt.

Note that launching the JVM with --illegal-access=deny will often work fine for Spring purposes, making the warning disappear and nevertheless being able to define the class at runtime since we'll automatically fall back to Lookup.defineClass, accepting its implicit ClassLoader choice. This is not a general recommendation since it will prevent OSGi and other custom ClassLoader architectures from working properly... but it may be a fine choice for many apps, as long as the third-party frameworks in use are not failing on such 麓illegal麓 access attempts either.

@snicoll I think that you are receiving this reports because is the warning itself that says to report it here

@fadafez thank you. Adding a comment on a closed issue for something that could be totally unrelated is what I was trying to express. Hopefully you've reviewed the link in my comment.

I've tried with --illegal-access=deny, but it doesn't start anymore:

java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @dbb3c175
  at java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source) ~[?:?]
  at java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source) ~[?:?]
  at java.lang.reflect.Method.checkCanSetAccessible(Unknown Source) ~[?:?]
  at java.lang.reflect.Method.setAccessible(Unknown Source) ~[?:?]
  at org.springframework.util.ReflectionUtils.makeAccessible(ReflectionUtils.java:570) ~[spring-core-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.context.support.ContextTypeMatchClassLoader$ContextOverridingClassLoader.isEligibleForOverriding(ContextTypeMatchClassLoader.java:93) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.core.OverridingClassLoader.loadClass(OverridingClassLoader.java:87) ~[spring-core-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
  at org.springframework.core.OverridingClassLoader.loadClass(OverridingClassLoader.java:82) ~[spring-core-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.context.support.ContextTypeMatchClassLoader.loadClass(ContextTypeMatchClassLoader.java:69) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1528) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1468) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:682) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:649) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1604) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:520) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:491) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:191) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:722) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]

Running with a JDK 11.0.6_10_openj9-0.18.1 in a simple Spring Boot fat jar

@jhoeller

If it helps, for me it began occurring after I added a class which implements ApplicationListener<ApplicationReadyEvent>

This is happening with Spring 5.2.4 and Amazon JDK 11.0.6.

The warning appears in IntelliJ (IntelliJ IDEA 2019.3.4 (Ultimate Edition) Build #IU-193.6911.18) when running the springboot app in Debug mode. In a non-debug 'Run' the warning does not occur.

this might help make the warning dissappear https://github.com/spring-projects/spring-framework/issues/22814#issuecomment-557456953

For me it resolved, in Windows 10
In Intellij IDEA Community Edition 2019.2.3 follow the steps:

  • Go to the C:\Users\UserName.m2 directory and remove everything.
  • In Intellij, right click on the project, Maven > Reimport
  • Expect to load all dependencies.
  • Right click on the project, Open Module Settings > Change the SDK to 1.8.0_221.

In Eclipse IDE Jee 2019-09 follow the steps:

  • Go to the C:\Users\UserName.m2 directory and remove everything.
  • In Eclipse, right click on the project, Run As > Maven Build... and type clear install in the Goals field, and Run
  • Expect to load all dependencies.
  • Change the SDK to 1.8.0_221.

Hope this helps.

Illegal reflective access by org.springframework.cglib.core.ReflectUtils - spring-core-5.2.5.RELEASE.jar
.m2/repository/org/springframework/spring-core/5.2.5.RELEASE/spring-core-5.2.5.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

For myself it started to appear when using Spring HATEOAS - linkTo(methodOn(Some.class))

Using latest Spring boot with self auto-wiring a service (singleton bean) caused to show this message

Spring boot 2.2.6.RELEASE

For me it resolved, in Windows 10
In Intellij IDEA Community Edition 2019.2.3 follow the steps:

  • Go to the C:\Users\UserName.m2 directory and remove everything.
  • In Intellij, right click on the project, Maven > Reimport
  • Expect to load all dependencies.
  • Right click on the project, Open Module Settings > Change the SDK to 1.8.0_221.

In Eclipse IDE Jee 2019-09 follow the steps:

  • Go to the C:\Users\UserName.m2 directory and remove everything.
  • In Eclipse, right click on the project, Run As > Maven Build... and type clear install in the Goals field, and Run
  • Expect to load all dependencies.
  • Change the SDK to 1.8.0_221.

Hope this helps.

Thank you so much. It's working.

I have the same issue when I use spring.profiles.active property, without it, works perfectly

I use spring 2.3.0 and java 11.0.2

java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:~/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-impl/2.3.0.1/2e979dabb3e5e74a0686115075956391a14dece8/jaxb-impl-2.3.0.1.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Hi,

I am getting warnings after upgrading java version from 1.8 to java 11 and spring-boot version1.5.3 to 2.3.0.

java version "11.0.7" 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode)

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/..../.m2/repository/org/springframework/spring-core/5.2.6.RELEASE/spring-core-5.2.6.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/..../.m2/repository/org/springframework/spring-core/5.2.6.RELEASE/spring-core-5.2.6.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
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

AdoptOpenJdk 14.0.1
Spring Boot 2.3.1

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/condo/.m2/repository/org/springframework/spring-core/5.2.7.RELEASE/spring-core-5.2.7.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Edit | 2020-11-16:
AdoptOpenJDK: 15.0.1+9
Spring Boot 2.4.0.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/condo/.m2/repository/org/springframework/spring-core/5.3.1/spring-core-5.3.1.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Azul Zulu 11.0.6
Zulu 11.37+17 4c3a2c98f1f6
OpenJSSE 1.1.2 549936e0c69481addad323098e23f307a0e98bce
Spring Boot 2.2.4.RELEASE / on latest 2.2.*

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/talos/.m2/repository/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

This has just happened for me.
I'm on spring-core/5.3.0-M1, spring-boot/2.4.0-M1.
If it helps, it started happening after I added a class implementing ApplicationContextAware to provide access to Beans from outside Spring code, as described in this article.

Happening to me as well.
Windows 10 / Amazon Coretto JDK 11/ Spring Boot 2.3.4 RELEASE

Happening to me as well.
Windows 10 / Oracle JDK 11.0.8 / Spring Boot 2.3.4 RELEASE

@jhoeller Considering that there is now https://openjdk.java.net/jeps/396 which will replace this warning with an error (application will fail to start) are the plans on somehow fix the issue in all cases? This JEP doesn't yet have a target release, but both JDK 16 and 17 are likely.

Or maybe report issue to JDK that defineClass is lacking some feature?
I would gladly do that, but I don't know anything about reflection in Java :(

Same issue
Mac OS / Oracle JDK 11.0.9 / Spring Boot 2.3.4
and
Mac OS / AdoptOpen JDK 11.0 / Spring Boot 2.3.4

Resolved for me after upgrade to Spring Boot 2.4.0.

still the same error with Spring Boot 2.4.0 and adopt openJDK 15.0.1 under macOS BigSur 11.0.1

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/Users/ra/.m2/repository/org/springframework/spring-core/5.3.1/spring-core-5.3.1.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

still the same error with Spring Boot 2.4.0 and adopt openJDK 15.0.1 under macOS BigSur 11.0.1

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/Users/ra/.m2/repository/org/springframework/spring-core/5.3.1/spring-core-5.3.1.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
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

I'm getting the same in JDK 11(adopt-openj9-11.0.9)

same issue.

Mac OS 10.15.7 / Spring Boot 2.4.1

openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)

A quick update: See my comment at https://github.com/spring-projects/spring-framework/issues/22814#issuecomment-762862757 -
We're fine-tuning our defineClass handling for Boot's DevTools where a significant number of warnings comes from at the moment. Proxying for JDK library classes remains tough, as explained there as well.

Please note that many scenarios are going to work ok even with --illegal-access=deny in JDK 16 since we have a fallback in place once our defineClass attempt fails. Nevertheless, we'd like to address all remaining Boot scenarios so that we do not need to reflectively call ClassLoader.defineClass at all anymore, avoiding warnings with --illegal-access=warn.

An easy way out is also --add-opens java.base/java.lang=ALL-UNNAMED on JVM startup, getting rid of the warning in any scenario and also making any scenario work with --illegal-access=deny. All we're trying to do is improve the default experience with Spring Boot 2.4.x / 2.5 on Spring Framework 5.3.x, given the advent of JDK 16 and then JDK 17 LTS.

Was this page helpful?
0 / 5 - 0 ratings