quarkusio/quarkus · error · ConfigurationException

Hibernate Envers activated explicitly for persistence unit '

Error message

Hibernate Envers activated explicitly for persistence unit '${puName}', but the Hibernate Envers extension was disabled at build time. If you want Hibernate Envers to be active for this persistence unit, you must set '${enabledPropertyKey}' to 'true' at build time. If you don't want Hibernate Envers to be active for this persistence unit, you must leave '${activePropertyKey}' unset or set it to 'false'.

What it means

At build time, if the Hibernate Envers extension was disabled (quarkus.hibernate-envers.enabled=false) but a persistence unit explicitly sets <pu>.active=true, Quarkus fails the build with a ConfigurationException explaining the conflict and pointing to the exact build-time property to change.

Source

Thrown at extensions/hibernate-envers/deployment/src/main/java/io/quarkus/hibernate/envers/deployment/HibernateEnversDisabledProcessor.java:46

            integrationProducer.produce(
                    new HibernateOrmIntegrationStaticConfiguredBuildItem(HibernateEnversProcessor.HIBERNATE_ENVERS,
                            puDescriptor.getPersistenceUnitName())
                            .setInitListener(recorder.createStaticInitInactiveListener())
                            // We don't need XML mapping if Envers is disabled
                            .setXmlMappingRequired(false));
        }
    }

    // TODO move this to runtime init once we implement in Hibernate ORM a way
    //  to remove entity types from the metamodel on runtime init
    public void checkNoExplicitActiveTrue(HibernateEnversBuildTimeConfig buildTimeConfig) {
        for (var entry : buildTimeConfig.persistenceUnits().entrySet()) {
            var config = entry.getValue();
            if (config.active().isPresent() && config.active().get()) {
                var puName = entry.getKey();
                String enabledPropertyKey = HibernateEnversBuildTimeConfig.extensionPropertyKey("enabled");
                String activePropertyKey = HibernateEnversBuildTimeConfig.persistenceUnitPropertyKey(puName, "active");
                throw new ConfigurationException(
                        "Hibernate Envers activated explicitly for persistence unit '" + puName
                                + "', but the Hibernate Envers extension was disabled at build time."
                                + " If you want Hibernate Envers to be active for this persistence unit, you must set '"
                                + enabledPropertyKey
                                + "' to 'true' at build time."
                                + " If you don't want Hibernate Envers to be active for this persistence unit, you must leave '"
                                + activePropertyKey
                                + "' unset or set it to 'false'.",
                        Set.of(enabledPropertyKey, activePropertyKey));
            }
        }
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.hibernate-envers.enabled=true at build time to use Envers for that persistence unit
  2. Or remove the quarkus.hibernate-envers.<pu>.active=true entry (or set it to false/unset) to keep Envers disabled

Example fix

// before
quarkus.hibernate-envers.enabled=false
quarkus.hibernate-envers."<default>".active=true
// after
quarkus.hibernate-envers.enabled=true
quarkus.hibernate-envers."<default>".active=true
Defensive patterns

Strategy: validation

Validate before calling

if (!config.enabled() && config.persistenceUnits().values().stream()
        .anyMatch(c -> c.active().orElse(false))) {
    throw new IllegalArgumentException("Set quarkus.hibernate-envers.enabled=true or remove <pu>.active=true");
}

Try / catch

try {
    build();
} catch (ConfigurationException e) {
    if (e.getMessage().contains("Hibernate Envers")) {
        LOG.error("Fix build-time Envers properties as described in the message");
    }
    throw e;
}

Prevention

When it happens

Trigger: Having quarkus.hibernate-envers.enabled=false (or omitting it while disabled) together with quarkus.hibernate-envers.<persistence-unit-name>.active=true in application.properties, during static init/disableHibernateEnversStaticInit.

Common situations: Explicitly activating Envers per PU while the extension is globally disabled; config left over after disabling the extension; misunderstanding that active=true can re-enable a build-time-disabled extension.

Related errors


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