{"record":{"id":"0d47528ba70292c4","repo":"pinpoint-apm/pinpoint","slug":"expected-method-not-found-for-retrieving-jvm-cpu-u","errorCode":null,"errorMessage":"Expected method not found for retrieving jvm cpu usage. Cause : {}","messagePattern":"Expected method not found for retrieving jvm cpu usage\\. Cause : (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agent-module/profiler-optional/profiler-optional-jdk8/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/cpu/ibm/DefaultCpuLoadMetric.java","lineNumber":48,"sourceCode":" */\npublic class DefaultCpuLoadMetric implements CpuLoadMetric {\n\n    private final Logger logger = LogManager.getLogger(this.getClass());\n\n    private final CpuUsageProvider jvmCpuUsageProvider;\n    private final CpuUsageProvider systemCpuUsageProvider;\n\n    public DefaultCpuLoadMetric() {\n        final OperatingSystemMXBean operatingSystemMXBean = (com.ibm.lang.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();\n        if (operatingSystemMXBean == null) {\n            throw new IllegalStateException(\"OperatingSystemMXBean not available\");\n        }\n\n        CpuUsageProvider jvmCpuUsageProvider = new JvmCpuUsageProvider(operatingSystemMXBean);\n        try {\n            jvmCpuUsageProvider.getCpuUsage();\n        } catch (NoSuchMethodError e) {\n            logger.warn(\"Expected method not found for retrieving jvm cpu usage. Cause : {}\", e.getMessage());\n            jvmCpuUsageProvider = CpuUsageProvider.UNSUPPORTED;\n        }\n        this.jvmCpuUsageProvider = jvmCpuUsageProvider;\n\n        CpuUsageProvider systemCpuUsageProvider = new SystemCpuUsageProvider(operatingSystemMXBean);\n        try {\n            systemCpuUsageProvider.getCpuUsage();\n        } catch (NoSuchMethodError e) {\n            logger.warn(\"Expected method not found for retrieving system cpu usage. Cause : {}\", e.getMessage());\n            systemCpuUsageProvider = CpuUsageProvider.UNSUPPORTED;\n        }\n        this.systemCpuUsageProvider = systemCpuUsageProvider;\n    }\n\n    @Override\n    public CpuLoadMetricSnapshot getSnapshot() {\n        double jvmCpuUsage = jvmCpuUsageProvider.getCpuUsage();\n        double systemCpuUsage = systemCpuUsageProvider.getCpuUsage();","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler-optional/profiler-optional-jdk8/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/cpu/ibm/DefaultCpuLoadMetric.java#L30-L66","documentation":"DefaultCpuLoadMetric (IBM JVM variant) probes the OperatingSystemMXBean at construction by calling jvmCpuUsageProvider.getCpuUsage() once. If an IBM-specific method is missing on the current JVM, NoSuchMethodError is caught, a warning 'Expected method not found for retrieving jvm cpu usage' is logged, and the provider is downgraded to CpuUsageProvider.UNSUPPORTED so JVM CPU metrics return null instead of crashing.","triggerScenarios":"Constructing DefaultCpuLoadMetric on a JVM whose com.ibm.lang.management.OperatingSystemMXBean lacks the expected processCpuLoad-style method — i.e. non-IBM JRE or an IBM JRE version older than the probed API.","commonSituations":"Running the profiler on OpenJDK/HotSpot while the ibm metric package was loaded; old IBM Java 7/8 builds without the CPU load methods; shaded/wrong MXBean class on the classpath.","solutions":["Run on the JVM family the metric class targets (IBM JRE for the ibm package)","Verify IBM JRE version supports the probed OperatingSystemMXBean methods (IBM 7.0.1+/8+)","Ignore the warning if only system CPU metrics are needed — jvm CPU will be reported as unsupported","Check the profiler-optional-jdk8 module is compatible with the runtime JVM vendor"],"exampleFix":"// before (forcing IBM metrics on HotSpot)\nmetricRegistry.register(\"jvm.cpu\", new com.navercorp.pinpoint.profiler.monitor.metric.cpu.ibm.DefaultCpuLoadMetric(osBean));\n// after (let Pinpoint select by JVM vendor)\nCpuLoadMetricGetter getter = CpuLoadMetricSelector.getCpuLoadMetricGetter(); // returns oracle/ibm variant appropriately","handlingStrategy":"fallback","validationCode":"java.lang.management.OperatingSystemMXBean bean = ManagementFactory.getOperatingSystemMXBean(); boolean isIbm = bean instanceof com.ibm.lang.management.OperatingSystemMXBean; if (!isIbm) use oracle/standard variant;","typeGuard":"boolean isIbmOsBean(java.lang.management.OperatingSystemMXBean b) { return b instanceof com.ibm.lang.management.OperatingSystemMXBean; }","tryCatchPattern":"try { provider.getCpuUsage(); } catch (NoSuchMethodError e) { provider = CpuUsageProvider.UNSUPPORTED; } // built-in: metrics degrade to null","preventionTips":["Match the metric implementation package (ibm vs oracle) to the JVM vendor","Verify IBM JRE version supports the probed MXBean methods","Probe MXBean methods once at startup (as Pinpoint does) rather than per metric read","Treat CPU-unsupported as acceptable degradation on non-matching JVMs"],"tags":["jvm","monitoring","cpu-metrics","ibm","nosuchmethod"],"backgroundTag":"unsupported-platform","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}