New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 #1133
Comments
I'm seeing this too on Gerrit Code Review, and further warnings: WARNING: Illegal reflective access by com.google.inject.assistedinject.FactoryProvider2$MethodHandleWrapper (file:/home/davido/.gerritcodereview/tmp/gerrit_13189476373589339762_app/guice-assistedinject-4.1.0.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) |
Also shown when running hadoop 3.0.0 with JDK9 |
Has this been resolved? |
Should this be fixed within Guice or within the cglib? |
Still happening for me with 4.2.0, even though its release notes list it as Java 9 compatible. |
Switching from cglib to ByteBuddy would be a nice fix. |
What progress with this? Got it on Spring Boot projects on Java 10. Is ByteBuddy will fix that? Also So this affects all projects with maven. |
Very easy to fix... Then |
this warning is really anoying pls fix |
Did you try latest release 4.2.2? |
Without add-opens
|
Should I remove the system property? |
Sadly, the same issue here:
My setup:
Looks to me that no progress has been made on this issue by just updating guice to the newest cglib & asm versions. |
Some findings: Adding VM option
However, after adding VM option
|
That looks like you aren't running in modular mode, plus opening all-unnamed you mine-as-well not use modules at all Are you starting your app using the modular system? e.g. mine is java.exe --add-opens java.base/java.lang=com.google.guice,javassist -Dfile.encoding=UTF-8 -m com.jwebmp.examples.demos.homepage/com.jwebmp.examples.demos.homepage.HomePageStartup |
Above fix does remove warnings. applicationDefaultJvmArgs = ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] |
Note there are 2 different issues when using Java9+
The second issue will require more changes to CGLIB to use the new lookup API when running on JPMS, rather than reflection. (Either that or switch to use ByteBuddy) Until then running applications using the classic classpath shouldn't trigger warnings, because the new module access checks don't kick in. Similarly using If you don't need AOP then you could also consider using the |
Also found when using Guice - it's better to have an open module for your running app rather than opens/exports package to com.google.guice (for AOP) - especially for larger projects, the module-info gets bloated and it becomes a little messy.
|
yes |
Awaiting a final release to address this bug |
I use guice:5.0.0-BETA-1 in production for months now. Try it out! |
I have, but some of us depend on other packages that depend on Guice, and whose maintainers won't release with a dependency on a beta version of something or other (and rightly so). |
Require Java 11. Update gradle and plugins. Use scala 2.11.12. Fix sources for newer Java+Scala Update akka, jetty open java.base/sun.nio.channel to avoid warning "Illegal reflective access by org.midonet.netlink.NetlinkSelectorProvider" open java.base/java.lang to avoid warning "Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1" (see google/guice#1133)
Require Java 11. Update gradle and plugins. Use scala 2.11.12. Fix sources for newer Java+Scala Update akka, jetty open java.base/sun.nio.channel to avoid warning "Illegal reflective access by org.midonet.netlink.NetlinkSelectorProvider" open java.base/java.lang to avoid warning "Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1" (see google/guice#1133)
Require Java 11. Update gradle and plugins. Use scala 2.11.12. Fix sources for newer Java+Scala Update akka, jetty open java.base/sun.nio.channel to avoid warning "Illegal reflective access by org.midonet.netlink.NetlinkSelectorProvider" open java.base/java.lang to avoid warning "Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1" (see google/guice#1133)
Require Java 11. Update gradle and plugins. Use scala 2.11.12. Fix sources for newer Java+Scala Update akka, jetty open java.base/sun.nio.channel to avoid warning "Illegal reflective access by org.midonet.netlink.NetlinkSelectorProvider" open java.base/java.lang to avoid warning "Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1" (see google/guice#1133)
Require Java 11. Update gradle and plugins. Use scala 2.11.12. Fix sources for newer Java+Scala Update akka, jetty open java.base/sun.nio.channel to avoid warning "Illegal reflective access by org.midonet.netlink.NetlinkSelectorProvider" open java.base/java.lang to avoid warning "Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1" (see google/guice#1133) Fix deprecations Fix deprecation clazz.newInstance() -> clazz.getDeclaredConstructor().newInstance()
Just FYI, Guice 5.0.1 that was released in February 2021 seems to have resolved this issue. I had to find out it was released by going to mvn repository. |
Finally fixed 'illegal reflective access' warnings with Java 9 or later. google/guice#1133 Full changelog: https://github.com/google/guice/wiki/Guice501
Finally fixed 'illegal reflective access' warnings with Java 9 or later. See: google/guice#1133 Full changelog: https://github.com/google/guice/wiki/Guice501 Fixes #7223 Fixes #9802
Guice 4.2.3 makes illegal reflective accesses that Java 17 does not allow. References google/guice#1133. Release notes: https://github.com/google/guice/wiki/Guice501
Guice 4.2.3 makes illegal reflective accesses that Java 17 does not allow. References google/guice#1133. Release notes: https://github.com/google/guice/wiki/Guice501
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (guice.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 com.google.inject.internal.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
affecting oracle java9 with maven
The text was updated successfully, but these errors were encountered: