pinpoint-apm/pinpoint · error · IllegalStateException
OperatingSystemMXBean not available
Error message
OperatingSystemMXBean not available
What it means
DefaultCpuLoadMetric for Oracle/HotSpot JDKs casts the platform OperatingSystemMXBean to com.sun.management.OperatingSystemMXBean and throws IllegalStateException if the bean is null. It guards construction of JVM CPU usage providers, meaning the JDK does not expose the expected com.sun.management MXBean.
Source
Thrown at agent-module/profiler-optional/profiler-optional-jdk8/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/cpu/oracle/DefaultCpuLoadMetric.java:41
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.management.ManagementFactory;
/**
* @author HyunGil Jeong
*/
public class DefaultCpuLoadMetric implements CpuLoadMetric {
private final Logger logger = LogManager.getLogger(this.getClass());
private final CpuUsageProvider jvmCpuUsageProvider;
private final CpuUsageProvider systemCpuUsageProvider;
public DefaultCpuLoadMetric() {
final OperatingSystemMXBean operatingSystemMXBean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
if (operatingSystemMXBean == null) {
throw new IllegalStateException("OperatingSystemMXBean not available");
}
CpuUsageProvider jvmCpuUsageProvider = new JvmCpuUsageProvider(operatingSystemMXBean);
try {
jvmCpuUsageProvider.getCpuUsage();
} catch (NoSuchMethodError e) {
logger.warn("Expected method not found for retrieving jvm cpu usage. Cause : {}", e.getMessage());
jvmCpuUsageProvider = CpuUsageProvider.UNSUPPORTED;
}
this.jvmCpuUsageProvider = jvmCpuUsageProvider;
CpuUsageProvider systemCpuUsageProvider = new SystemCpuUsageProvider(operatingSystemMXBean);
try {
systemCpuUsageProvider.getCpuUsage();
} catch (NoSuchMethodError e) {
logger.warn("Expected method not found for retrieving system cpu usage. Cause : {}", e.getMessage());
systemCpuUsageProvider = CpuUsageProvider.UNSUPPORTED;
}View on GitHub (pinned to 744c3d3075)
Solutions
- Run on a HotSpot/Oracle/OpenJDK JVM that implements com.sun.management.OperatingSystemMXBean
- Use the IBM or vendor-appropriate DefaultCpuLoadMetric module instead
- Disable the Oracle CpuLoadMetric plugin on non-HotSpot JVMs
- Check ManagementFactory.getOperatingSystemMXBean() class before enabling the plugin
Example fix
// before
new DefaultCpuLoadMetric(); // assumes HotSpot
// after
if (ManagementFactory.getOperatingSystemMXBean() instanceof com.sun.management.OperatingSystemMXBean) {
metric = new DefaultCpuLoadMetric();
} else {
metric = new UnsupportedCpuLoadMetric();
} Defensive patterns
Strategy: validation
Validate before calling
Object bean = ManagementFactory.getOperatingSystemMXBean(); boolean hotspotOk = bean instanceof com.sun.management.OperatingSystemMXBean;
Type guard
boolean isHotSpotOperatingSystemMXBean(OperatingSystemMXBean b) {
return b instanceof com.sun.management.OperatingSystemMXBean;
} Prevention
- Only load the Oracle CPU metric module on HotSpot-family JVMs
- Guard with instanceof before construction
- Document supported JVMs for your agent deployment
When it happens
Trigger: Constructing com.navercorp.pinpoint.profiler.monitor.metric.cpu.oracle.DefaultCpuLoadMetric when ManagementFactory.getOperatingSystemMXBean() is null or is not a com.sun.management.OperatingSystemMXBean (e.g. IBM J9, JRockit, or hardened JVMs).
Common situations: Running the agent on IBM/OpenJ9 or other non-HotSpot JVMs while the Oracle metric module is loaded; unusual JVM implementations lacking com.sun.management APIs; vendor-detection mistakes in plugin selection.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- OperatingSystemMXBean not available
- Expected method not found for retrieving jvm cpu usage. Caus
- Expected method not found for retrieving jvm cpu usage. Caus
- Expected method not found for retrieving system cpu usage. C
- Expected method not found for retrieving system cpu usage. C
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/c73992329a201274.
Report an issue: GitHub.