Skip to content

Actuator /info endpoint fails in Java 25 Native Image (VirtualThreadSchedulerMXBean support) #48810

@cmdjulian

Description

@cmdjulian

I am encountering an issue when running a Spring Boot 4.0.1 application built as a GraalVM Native Image using Java 25.

When accessing the /actuator/info endpoint, the application throws a HttpMessageNotWritableException. The root cause is an IllegalArgumentException stating that jdk.management.VirtualThreadSchedulerMXBean is not a platform management interface.

This occurs despite the recent changes in PR #43594, which added ProcessInfoContributorRuntimeHints to register this class for reflection. It appears that while the class is reflectively available, the ManagementFactory in the native image environment does not recognize it as a valid Platform MXBean.

Spring Boot Version: 4.0.1
Java Version: Java 25 (Oracle GraalVM 25+37.1)
Build System: Gradle (Kotlin DSL)

Steps to reproduce:
I have created a minimal reproducer repository.

  1. Clone the repository: https://github.com/cmdjulian/process-info-bug
  2. Build the native image:
./gradlew nativeCompile
  1. Run the application:
./build/native/nativeCompile/demo
  1. Query the endpoint:
curl -i http://localhost:8090/actuator/info

Observed Error:
The request fails with a 500 Internal Server Error. The logs show:

2026-01-13T14:25:44.338+01:00 ERROR ... 500 Server Error for HTTP GET "/actuator/info"
...
Caused by: java.lang.IllegalArgumentException: jdk.management.VirtualThreadSchedulerMXBean is not a platform management interface
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.management.ManagementSupport.getPlatformMXBean(ManagementSupport.java:142) ~[na:na]
    at java.management@25/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:56) ~[demo:na]
    at org.springframework.boot.info.ProcessInfo.getVirtualThreads(ProcessInfo.java:106) ~[demo:4.0.1]

Analysis:
The feature was introduced in PR #43594, which added the getVirtualThreads() method to ProcessInfo and included ProcessInfoContributorRuntimeHints to register jdk.management.VirtualThreadSchedulerMXBean for reflection.

However, the exception comes from ManagementFactory.getPlatformMXBean(Class), which validates if the requested class is a known platform MXBean. In a standard JVM, this works for VirtualThreadSchedulerMXBean in Java 24/25. In the Native Image (SubstrateVM), it seems this new MXBean is not automatically registered in the internal management support lookup, or ManagementFactory requires specific GraalVM configuration/substitution to recognize it, beyond just standard reflection hints.

Workaround Attempts:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions