quarkusio/quarkus · error · IllegalStateException

Not Implemented in native mode

Error message

Not Implemented in native mode

What it means

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).

Source

Thrown at core/runtime/src/main/java/io/quarkus/runtime/graal/Target_javax_management_JMX.java:21

import java.util.function.BooleanSupplier;

import javax.management.JMX;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(value = JMX.class, onlyWith = Target_javax_management_JMX.JmxServerNotIncluded.class)
final class Target_javax_management_JMX {

    @Substitute
    private static <T> T createProxy(MBeanServerConnection connection,
            ObjectName objectName,
            Class<T> interfaceClass,
            boolean notificationEmitter,
            boolean isMXBean) {
        throw new IllegalStateException("Not Implemented in native mode");
    }

    static final class JmxServerNotIncluded implements BooleanSupplier {

        @Override
        public boolean getAsBoolean() {
            String monitoringProperty = System.getProperty("quarkus.native.monitoring");
            if (monitoringProperty != null) {
                return !monitoringProperty.contains("jmxserver");
            }
            return true;
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Avoid JMX proxy creation in native mode; use an alternative management/monitoring mechanism (e.g. Quarkus management endpoints, Micrometer)
  2. Guard JMX code with a JVM-only check and disable it in native builds
  3. Run the JMX-dependent functionality only in JVM mode

Example fix

// before
MyMBean proxy = JMX.newMBeanProxy(connection, objectName, MyMBean.class);
// after
if (Runtime.getRuntime() instanceof QuarkusRuntimeCompatBase) { /* use management endpoint */ }
// or run only on JVM
Defensive patterns

Strategy: fallback

Validate before calling

// detect native mode before using JMX proxies
boolean nativeMode = System.getProperty("org.graalvm.nativeimage.isCompilable") != null || System.getProperty("java.vm.vendor", "").contains("GraalVM");

Try / catch

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; }

Prevention

When it happens

Trigger: Calling JMX.newMBeanProxy(...) / newMBeanServerConnection proxy creation against an MBeanServerConnection inside a native-image application.

Common situations: 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.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/8dade0b7e063b745. Report an issue: GitHub.