-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
(jdk17.0.4)Could not initialize class io.netty.util.internal.PlatformDependent0 #12737
Comments
Please show the whole stack trace. |
no java.lang.ExceptionInInitializerError |
@liyouxina how to reproduce? can produces this exception when I run the |
problem solved !! these args may have other that is not related to this problem, but I can not pick them out |
use rocketmq and jdk17, probably you can reproduce this |
add -Dsun.reflect.debugModuleAccessChecks=access to JVM args and run your application |
We run builds with Java 17, so this doesn't make much sense. Also, both |
Do we have plan to get rid of these unsupported/removed APIs instead of |
@tdvous They only opportunistically enable optimizations. Netty can run without them just fine. |
i hope change it that don't use java interal package,please. because java 21 also have this question. |
just like this
|
Oracle has discouraged the use of Unsafe and other similar low-level APIs because they can lead to security vulnerabilities and other issues. Starting with Java 9, Oracle began deprecating the use of Unsafe and planned to remove it in a future release. However, as of Java 17, Unsafe is still present but officially marked as deprecated. This means that Oracle recommends avoiding its use and finding alternative ways to achieve the same functionality without the associated risks. It’s important to note that the future inclusion of Unsafe in the Java standard library is not guaranteed, and it may be removed in a future release. Therefore, if you are writing new code, you should avoid using Unsafe and look for safer alternatives. If you are maintaining existing code that uses Unsafe, you should consider migrating to a safer approach as soon as possible. |
please use JEP 442 for java 21. maybe we can create a new version for this special. |
Expected behavior
same code works with jdk8
Actual behavior
Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.netty.util.internal.PlatformDependent0
at io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:694)
at io.netty.channel.nio.NioEventLoop$4.run(NioEventLoop.java:171)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:167)
at io.netty.channel.nio.NioEventLoop.(NioEventLoop.java:149)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:102)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:64)
at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:49)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:70)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:65)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:56)
Steps to reproduce
Minimal yet complete reproducer code (or URL to code)
Netty version
4.1.75.Final
JVM version (e.g.
java -version
)jdk17.0.4
OS version (e.g.
uname -a
)alios7.x86_64 #1 SMP Mon Jan 25 10:47:38 CST 2021 x86_64 x86_64 x86_64 GNU/Linux (some hidden)
The text was updated successfully, but these errors were encountered: