quarkusio/quarkus · error · IllegalStateException

No Vert.x instance has been registered in ArC ?

Error message

No Vert.x instance has been registered in ArC ?

What it means

During bootstrap of a Hibernate Reactive persistence unit, Quarkus rewires Hibernate's service registry and injects the application's managed Vert.x instance (looked up as a CDI bean in ArC). This error means no Vert.x bean was available in the CDI container when the reactive connection pool initiator was being registered. It indicates the Quarkus runtime wiring that normally provides Vert.x did not run or was bypassed.

Source

Thrown at extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/FastBootHibernateReactivePersistenceProvider.java:396

        }

        Pool pool;
        try {
            InjectableInstance<Pool> poolHandle = ReactiveDataSourceUtil.dataSourceInstance(datasourceName);
            if (!poolHandle.isResolvable()) {
                throw new IllegalStateException("No pool has been defined for persistence unit " + persistenceUnitName);
            }
            // ClientProxy.unwrap is necessary to trigger exceptions on inactive datasources
            pool = ClientProxy.unwrap(poolHandle.get());
        } catch (RuntimeException e) {
            throw PersistenceUnitUtil.unableToFindDataSource(persistenceUnitName, datasourceName, e);
        }

        serviceRegistry.addInitiator(new QuarkusReactiveConnectionPoolInitiator(pool));

        InstanceHandle<Vertx> vertxHandle = Arc.container().instance(Vertx.class);
        if (!vertxHandle.isAvailable()) {
            throw new IllegalStateException("No Vert.x instance has been registered in ArC ?");
        }
        serviceRegistry.addInitiator(new VertxInstanceInitiator(vertxHandle.get()));
    }

    private static void injectRuntimeConfiguration(HibernateOrmRuntimeConfigPersistenceUnit persistenceUnitConfig,
            Builder runtimeSettingsBuilder) {

        HibernateOrmRuntimeConfigPersistenceUnit.HibernateGenerationStrategy generationStrategy = persistenceUnitConfig
                .schemaManagement().strategy();
        if (!HibernateOrmRuntimeConfigPersistenceUnit.HibernateGenerationStrategy.NONE.equals(generationStrategy)
                && persistenceUnitConfig.database().startOffline()) {
            throw new PersistenceException(
                    "When using offline mode with `quarkus.hibernate-orm.database.start-offline=true`, the schema management strategy `quarkus.hibernate-orm.schema-management.strategy` must be unset or set to `none`");
        }

        // Pass extraPhysicalTableTypes configuration
        Optional<String> extraPhysicalTableTypes = persistenceUnitConfig.schemaManagement().extraPhysicalTableTypes();
        if (extraPhysicalTableTypes.isPresent()) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the quarkus-vertx extension (a transitive dependency of quarkus-hibernate-reactive) is present and the application is started via Quarkus so the Vert.x bean is registered in ArC
  2. Do not create the EntityManagerFactory manually; let Quarkus build it via the persistence provider (inject EntityManagerFactory or use @Inject)
  3. Check for classloading issues in tests (e.g. QuarkusTest vs plain JUnit) — use @QuarkusTest so the container and Vert.x bean exist
  4. If embedding Quarkus, verify Arc.container() is initialized before persistence bootstrap

Example fix

// before
EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu"); // bypasses Quarkus wiring
// after
@QuarkusTest
class MyTest {
  @Inject EntityManagerFactory emf; // Quarkus wires Vert.x + pool correctly
}
Defensive patterns

Strategy: validation

Validate before calling

import io.quarkus.arc.Arc;
import io.quarkus.arc.InstanceHandle;
import io.vertx.core.Vertx;

InstanceHandle<Vertx> h = Arc.container().instance(Vertx.class);
if (!h.isAvailable()) {
    throw new IllegalStateException("Bootstrap without Quarkus container; Vert.x bean unavailable");
}

Try / catch

try {
    emf = bootstrapPersistenceUnit();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("No Vert.x instance")) {
        throw new IllegalStateException("Run inside Quarkus (@QuarkusTest / quarkus:dev); manual PU creation is unsupported for Hibernate Reactive", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling FastBootHibernateReactivePersistenceProvider.rewireMetadataAndExtractServiceRegistry/registerVertxAndPool in an environment where Arc.container() has no Vertx instance registered — e.g. bootstrapping Hibernate Reactive persistence units outside the normal Quarkus startup (manual EntityManagerFactory creation, tests that skip the Quarkus Vertx producer, custom bootstrap code).

Common situations: Programmatic EntityManagerFactory creation in tests or tools; running Hibernate Reactive code without the quarkus-vertx extension on the classpath or without Quarkus Arc container started; classloader isolation in dev-mode restarting before Vert.x bean is re-registered.

Related errors


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