{"record":{"id":"01930bdcc96b9daa","repo":"pinpoint-apm/pinpoint","slug":"error-creating-cpuloadmetric","errorCode":null,"errorMessage":"Error creating CpuLoadMetric [{}]","messagePattern":"Error creating CpuLoadMetric \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/cpu/CpuLoadMetricProvider.java","lineNumber":89,"sourceCode":"        return null;\n    }\n\n    private CpuLoadMetric createCpuLoadMetric(String classToLoad) {\n        if (classToLoad == null) {\n            return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC;\n        }\n        try {\n            @SuppressWarnings(\"unchecked\")\n            Class<CpuLoadMetric> cpuLoadMetricClass = (Class<CpuLoadMetric>) Class.forName(classToLoad);\n            try {\n                Constructor<CpuLoadMetric> cpuLoadMetricConstructor = cpuLoadMetricClass.getConstructor();\n                return cpuLoadMetricConstructor.newInstance();\n            } catch (NoSuchMethodException e) {\n                logger.warn(\"Unknown CpuLoadMetric : {}\", classToLoad);\n                return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC;\n            }\n        } catch (ReflectiveOperationException e) {\n            logger.warn(\"Error creating CpuLoadMetric [\" + classToLoad + \"]\");\n            return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC;\n        }\n    }\n}\n","sourceCodeStart":71,"sourceCodeEnd":94,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/cpu/CpuLoadMetricProvider.java#L71-L94","documentation":"CpuLoadMetricProvider logs this when reflective instantiation of the CPU load metric class fails with any ReflectiveOperationException (ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException). The provider falls back to CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC, disabling CPU load collection while the agent keeps running.","triggerScenarios":"Class.forName cannot find the metric class on the agent classpath; the constructor is not accessible; the constructor throws during instantiation.","commonSituations":"Corrupt or trimmed agent deployment missing platform-specific metric classes; running on an OS/JVM combination whose metric class was never packaged; constructor throwing due to unavailable com.sun.management beans.","solutions":["Read the chained exception to distinguish ClassNotFoundException from InvocationTargetException","Confirm the expected metric class exists in the deployed pinpoint agent jar (jar tf / unzip -l)","Fix the constructor if it throws (e.g. guard against missing com.sun.management.OperatingSystemMXBean)","If the platform lacks the required MXBeans, accept the unsupported-metric fallback"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"jar tf pinpoint-agent.jar | grep -i CpuLoadMetric; // and confirm com.sun.management.OperatingSystemMXBean is reachable on the JVM","typeGuard":null,"tryCatchPattern":"try { return ctor.newInstance(); } catch (ReflectiveOperationException e) { logger.warn(\"Error creating CpuLoadMetric [{}]\", classToLoad, e); return CpuLoadMetric.UNSUPPORTED_CPU_LOAD_METRIC; }","preventionTips":["Deploy the full, unmodified Pinpoint agent distribution for your platform","Confirm the platform exposes the com.sun.management CPU MXBeans","Log the chained cause so load-vs-construct failures are distinguishable","Accept the unsupported fallback on platforms without CPU MXBeans instead of patching"],"tags":["reflection","metrics","class-loading","cpu"],"backgroundTag":"class-not-found","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"}