Document warnings that may be caused by Java 25's new restrictions
Closed this issue · 3 comments
When running an application using the Spring Boot OpenTelemetry Starter on Java 25, the following warning will be printed the first time metrics are exported via OTLP:
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::arrayBaseOffset has been called by com.google.protobuf.UnsafeUtil$MemoryAccessor (file:/Users/thomas/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/4.32.0/325c56fe5bb79cf288162d2d8d5f70b53fe1f507/protobuf-java-4.32.0.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.protobuf.UnsafeUtil$MemoryAccessor
WARNING: sun.misc.Unsafe::arrayBaseOffset will be removed in a future release
That's due to a transitive dependency used by Micrometer OTLP, as described in micrometer-metrics/micrometer#6852.
I would like to suggest documenting this warning and perhaps explaining its meaning.
How to reproduce it:
- Generate a new project from Spring Initializr for Spring Boot 4.0.0-RC1 and Java 25 with these dependencies: Spring Web, OpenTelemetry, Testcontainers.
- Run the application from the test classpath.
- Notice the warning being printed in the logs after the first metrics export interval (by default, it's 1 minute, but it can be changed via
management.otlp.metrics.export.stepto inspect the warning sooner).
Thanks for the suggestion. I think we could add something that's quite general to the wiki. I don't think it's practical to document specific warnings as there are many dependencies that Boot manages that have yet to fully adapt to Java 25's restrictions and each will produce a different warning.
@wilkinsona thank you for the quick answer. It makes sense to have a general warning as there can be more transitive dependencies causing this.