quarkusio/quarkus · error · IllegalStateException

Not Implemented in native mode

Error message

Not Implemented in native mode

What it means

Quarkus substitutes MySQL's ConnectionGroupManager.registerJmx with a stub that throws IllegalStateException. JMX registration for the load-balancing connection group manager uses classes excluded from the native image, so this JMX integration is not implemented in native mode.

Source

Thrown at extensions/jdbc/jdbc-mysql/runtime/src/main/java/io/quarkus/jdbc/mysql/runtime/graal/com/mysql/cj/jdbc/MySQLJDBCSubstitutions.java:41

                        " If you need this resolved, please open a support request.");
    }

    @Substitute
    private void initializePrivateKey() {
        throw ExceptionFactory
                .createException("OciClient authentication is not available in Quarkus when compiling to native-image:" +
                        " the MySQL JDBC driver team needs to cleanup the dependency requirements to make this possible." +
                        " If you need this resolved, please open a support request.");
    }

}

@TargetClass(className = "com.mysql.cj.jdbc.ConnectionGroupManager")
final class ConnectionGroupManager {

    @Substitute
    public static void registerJmx() throws SQLException {
        throw new IllegalStateException("Not Implemented in native mode");
    }

}

@TargetClass(className = "com.mysql.cj.jdbc.jmx.LoadBalanceConnectionGroupManager")
final class LoadBalanceConnectionGroupManager {

    @Substitute
    public synchronized void registerJmx() throws java.sql.SQLException {
        throw new IllegalStateException("Not Implemented in native mode");
    }

}

@TargetClass(className = "com.mysql.cj.jdbc.jmx.ReplicationGroupManager")
final class ReplicationGroupManager {

    @Substitute

View on GitHub (pinned to e1c734241f)

Solutions

  1. Avoid the loadbalance/replication URL in native mode; connect to a single host or use a TCP proxy/load balancer (e.g. ProxySQL, HAProxy, cloud LB) in front of MySQL
  2. Disable JMX for the driver/monitor the group externally instead of via JMX
  3. Deploy in JVM mode if MySQL load-balancing JMX monitoring is required
  4. Use Quarkus datasource multiple URLs / Agroal failover instead of driver-level load balancing

Example fix

// before
String url = "jdbc:mysql:loadbalance://node1:3306,node2:3306/db";
// after
String url = "jdbc:mysql://mysql-lb.internal:3306/db"; // TCP load balancer in front
Defensive patterns

Strategy: validation

Validate before calling

if (url.startsWith("jdbc:mysql:loadbalance://") && jmxMonitoringEnabled) { throw new IllegalArgumentException("MySQL loadbalance JMX registration is not implemented in native mode"); }

Type guard

static boolean usesLoadBalanceUrl(String url) { return url != null && url.startsWith("jdbc:mysql:loadbalance://"); }

Try / catch

try { conn = ds.getConnection(); } catch (IllegalStateException e) { if (e.getMessage().contains("Not Implemented in native mode")) { log.error("Use a TCP load balancer instead of driver loadbalance JMX"); } throw e; }

Prevention

When it happens

Trigger: Native-mode usage of MySQL Connector/J load balancing (jdbc:mysql:loadbalance://...) or replication URLs when the driver attempts to register its connection group with the platform MBean server (registerJmx() called during load-balance setup).

Common situations: Apps using MySQL load-balanced URLs with JMX monitoring; code or driver versions that enable JMX registration by default; migrating a monitored JVM deployment to native image.

Related errors


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