pinpoint-apm/pinpoint · warning

Expected method not found for retrieving jvm cpu usage. Caus

Error message

Expected method not found for retrieving jvm cpu usage. Cause : {}

What it means

Oracle/HotSpot variant of DefaultCpuLoadMetric performing the same construction-time probe of the JvmCpuUsageProvider. On NoSuchMethodError it warns 'Expected method not found for retrieving jvm cpu usage' and swaps in CpuUsageProvider.UNSUPPORTED, degrading JVM CPU metrics to null instead of failing agent startup.

Source

Thrown at agent-module/profiler-optional/profiler-optional-jdk8/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/cpu/oracle/DefaultCpuLoadMetric.java:48

 */
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;
        }
        this.systemCpuUsageProvider = systemCpuUsageProvider;
    }

    @Override
    public CpuLoadMetricSnapshot getSnapshot() {
        double jvmCpuUsage = jvmCpuUsageProvider.getCpuUsage();
        double systemCpuUsage = systemCpuUsageProvider.getCpuUsage();

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Run on a HotSpot/OpenJDK JDK 7+ where getProcessCpuLoad exists
  2. Use the IBM metric variant (ibm package) when on J9/JRockit
  3. Accept degraded metrics — the warning means jvm CPU will be unsupported, agent still works
  4. Check JVM flags/security policy if com.sun.management access is blocked

Example fix

// before (Oracle variant on J9 JVM)
new com.navercorp.pinpoint.profiler.monitor.metric.cpu.oracle.DefaultCpuLoadMetric(osBean);
// after (vendor-aware selection)
if (vendor.contains("IBM")) { metric = new ...ibm.DefaultCpuLoadMetric(osBean); } else { metric = new ...oracle.DefaultCpuLoadMetric(osBean); }
Defensive patterns

Strategy: fallback

Validate before calling

java.lang.management.OperatingSystemMXBean bean = ManagementFactory.getOperatingSystemMXBean(); boolean supportsJvmCpu = (bean instanceof com.sun.management.OperatingSystemMXBean); if (!supportsJvmCpu) use ibm variant or skip;

Type guard

boolean isSunOsBean(java.lang.management.OperatingSystemMXBean b) { return b instanceof com.sun.management.OperatingSystemMXBean; }

Try / catch

try { jvmProvider.getCpuUsage(); } catch (NoSuchMethodError e) { jvmProvider = CpuUsageProvider.UNSUPPORTED; }

Prevention

When it happens

Trigger: Constructing the oracle DefaultCpuLoadMetric on a JVM whose com.sun.management.OperatingSystemMXBean lacks getProcessCpuLoad — typically a non-Sun/Oracle JVM (J9, JRockit) or very old JDK 6 without the method.

Common situations: Running the agent on IBM J9 while the Oracle metric implementation was selected; minimal/trimmed JRE; JDK version where the com.sun API is unavailable or restricted (e.g. security policy blocking com.sun).

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


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/cea0381ac652508c. Report an issue: GitHub.