Skip to content
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

OSGi sun.misc.Unsafe::staticFieldOffset warnings in console log in Java 24 #30621

Open
gjwatts opened this issue Jan 23, 2025 · 1 comment
Open
Assignees
Labels

Comments

@gjwatts
Copy link
Member

gjwatts commented Jan 23, 2025

When starting an Open Liberty server running with Java 24, the following warnings show up in the console.log:

WARNING: package sun.security.action not in java.base
Launching gjw (Open Liberty 25.0.0.1/wlp-1.0.97.202501221624) on OpenJDK 64-Bit Server VM, version 24-ea+31-3600 (en_US)
[AUDIT   ] CWWKE0001I: The server gjw has been launched.
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::staticFieldOffset has been called by org.eclipse.osgi.internal.url.MultiplexingFactory (file:/D:/git/liberty/open-liberty/dev/build.image/wlp/lib/org.eclipse.osgi_3.21.0.jar)
WARNING: Please consider reporting this to the maintainers of class org.eclipse.osgi.internal.url.MultiplexingFactory
WARNING: sun.misc.Unsafe::staticFieldOffset will be removed in a future release
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications.
[AUDIT   ] CWWKF0012I: The server installed the following features: [el-3.0, jsp-2.3, servlet-3.1].
[AUDIT   ] CWWKF0011I: The gjw server is ready to run a smarter planet. The gjw server started in 2.060 seconds.
[AUDIT   ] CWWKE0055I: Server shutdown requested on Wednesday, January 22, 2025 at 5:32?PM. The server gjw is shutting down.
[AUDIT   ] CWWKE1100I: Waiting for up to 30 seconds for the server to quiesce.
[AUDIT   ] CWWKE0036I: The server gjw stopped after 9.764 seconds.

This is tied to JEP 471, which was released in Java 23 and JEP 498, being released in Java 24. Here is the expected timeline as mentioned in JEP 471:

As to timing, we plan to implement
    Phase 1, via this JEP, in JDK 23;
    Phase 2, issuing run-time warnings, in or before JDK 25;
    Phase 3, throwing exceptions by default, in JDK 26 or later; and
    Phases 4 and 5, which will remove the methods, in releases following JDK 26.
@tjwatson
Copy link
Member

The source in question is setting up some (optional) functionality if the Unsafe class and methods are available. If they are not available at runtime then the code should "safely" recover without the optional functionality. If we must avoid the warnings then I may need to introduce an option in Equinox to disable the "setup" code altogether. Once Java 26 is released and there is no more method at all the Equinox code should recover with no warning at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants