{"record":{"id":"8dade0b7e063b745","repo":"quarkusio/quarkus","slug":"not-implemented-in-native-mode","errorCode":null,"errorMessage":"Not Implemented in native mode","messagePattern":"Not Implemented in native mode","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/runtime/src/main/java/io/quarkus/runtime/graal/Target_javax_management_JMX.java","lineNumber":21,"sourceCode":"import java.util.function.BooleanSupplier;\n\nimport javax.management.JMX;\nimport javax.management.MBeanServerConnection;\nimport javax.management.ObjectName;\n\nimport com.oracle.svm.core.annotate.Substitute;\nimport com.oracle.svm.core.annotate.TargetClass;\n\n@TargetClass(value = JMX.class, onlyWith = Target_javax_management_JMX.JmxServerNotIncluded.class)\nfinal class Target_javax_management_JMX {\n\n    @Substitute\n    private static <T> T createProxy(MBeanServerConnection connection,\n            ObjectName objectName,\n            Class<T> interfaceClass,\n            boolean notificationEmitter,\n            boolean isMXBean) {\n        throw new IllegalStateException(\"Not Implemented in native mode\");\n    }\n\n    static final class JmxServerNotIncluded implements BooleanSupplier {\n\n        @Override\n        public boolean getAsBoolean() {\n            String monitoringProperty = System.getProperty(\"quarkus.native.monitoring\");\n            if (monitoringProperty != null) {\n                return !monitoringProperty.contains(\"jmxserver\");\n            }\n            return true;\n        }\n    }\n}\n","sourceCodeStart":3,"sourceCodeEnd":36,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/runtime/src/main/java/io/quarkus/runtime/graal/Target_javax_management_JMX.java#L3-L36","documentation":"Quarkus substitutes javax.management.JMX.createProxy in native mode because JMX remote proxies are not supported in native images; the substitute throws IllegalStateException \"Not Implemented in native mode\". This only happens when the JMX server classes are not included (JmxServerNotIncluded).","triggerScenarios":"Calling JMX.newMBeanProxy(...) / newMBeanServerConnection proxy creation against an MBeanServerConnection inside a native-image application.","commonSituations":"Monitoring/management code that connects to MBean servers and creates MBean proxies, moved to native mode; libraries doing JMX-based health or metrics lookup at runtime.","solutions":["Avoid JMX proxy creation in native mode; use an alternative management/monitoring mechanism (e.g. Quarkus management endpoints, Micrometer)","Guard JMX code with a JVM-only check and disable it in native builds","Run the JMX-dependent functionality only in JVM mode"],"exampleFix":"// before\nMyMBean proxy = JMX.newMBeanProxy(connection, objectName, MyMBean.class);\n// after\nif (Runtime.getRuntime() instanceof QuarkusRuntimeCompatBase) { /* use management endpoint */ }\n// or run only on JVM","handlingStrategy":"fallback","validationCode":"// detect native mode before using JMX proxies\nboolean nativeMode = System.getProperty(\"org.graalvm.nativeimage.isCompilable\") != null || System.getProperty(\"java.vm.vendor\", \"\").contains(\"GraalVM\");","typeGuard":null,"tryCatchPattern":"try { mbean = JMX.newMBeanProxy(conn, name, MxBean.class); } catch (IllegalStateException e) { if (e.getMessage().contains(\"Not Implemented in native mode\")) { mbean = null; /* use REST/management API */ } else throw e; }","preventionTips":["Avoid JMX in native-image apps; use Micrometer/management endpoints","Isolate JMX code behind an interface with a JVM-only implementation","Run JMX-dependent features only in JVM mode"],"tags":["native-image","jmx","graalvm"],"backgroundTag":"api-not-supported-native","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}