{"record":{"id":"96fa62a9515d1099","repo":"quarkusio/quarkus","slug":"booting-a-blocking-hibernate-orm-serviceregistry-o","errorCode":null,"errorMessage":"Booting a blocking Hibernate ORM serviceregistry on a Reactive RecordedState!","messagePattern":"Booting a blocking Hibernate ORM serviceregistry on a Reactive RecordedState!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/registry/PreconfiguredServiceRegistryBuilder.java","lineNumber":74,"sourceCode":" * Helps to instantiate a ServiceRegistryBuilder from a previous state. This\n * will perform only minimal configuration validation and will never modify the\n * given configuration properties.\n * <p>\n * Meant to be used only to rebuild a previously created ServiceRegistry, which\n * has been created via the traditional methods, so this builder expects much\n * more explicit input.\n */\npublic class PreconfiguredServiceRegistryBuilder {\n\n    private final Map<String, Object> configurationValues = new HashMap<>();\n    private final List<StandardServiceInitiator<?>> initiators;\n    private final List<ProvidedService<?>> providedServices = new ArrayList<ProvidedService<?>>();\n    private final Collection<Integrator> integrators;\n    private final StandardServiceRegistryImpl destroyedRegistry;\n\n    private void checkIsNotReactive(RecordedState rs) {\n        if (rs.isReactive())\n            throw new IllegalStateException(\"Booting a blocking Hibernate ORM serviceregistry on a Reactive RecordedState!\");\n    }\n\n    public PreconfiguredServiceRegistryBuilder(String puName, RecordedState rs,\n            HibernateOrmRuntimeConfigPersistenceUnit puConfig) {\n        checkIsNotReactive(rs);\n        this.initiators = buildQuarkusServiceInitiatorList(puName, rs, puConfig);\n        this.integrators = rs.getIntegrators();\n        this.destroyedRegistry = (StandardServiceRegistryImpl) rs.getMetadata()\n                .getMetadataBuildingOptions()\n                .getServiceRegistry();\n    }\n\n    public PreconfiguredServiceRegistryBuilder applySetting(String settingName, Object value) {\n        configurationValues.put(settingName, value);\n        return this;\n    }\n\n    public PreconfiguredServiceRegistryBuilder addInitiator(StandardServiceInitiator<?> initiator) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/registry/PreconfiguredServiceRegistryBuilder.java#L56-L92","documentation":"PreconfiguredServiceRegistryBuilder builds the blocking Hibernate ORM service registry from a RecordedState captured at augmentation time. checkIsNotReactive guards against misusing a RecordedState produced for Hibernate Reactive; booting the blocking registry with it would wire incompatible services, so it fails fast with this IllegalStateException.","triggerScenarios":"Calling PreconfiguredServiceRegistryBuilder (or the code paths that construct it, e.g. static-init boot of a blocking EntityManagerFactory) with a RecordedState whose isReactive() returns true — i.e. the PU was recorded by the reactive extension.","commonSituations":"Mixing blocking Hibernate ORM boot code with a PU configured for Hibernate Reactive; extension/custom code selecting the wrong RecordedState by persistence unit name; an app adding blocking SessionFactory boot to a reactive Panache application.","solutions":["Use the reactive bootstrap path (Reactive recorders / Hibernate Reactive registry builder) for reactive RecordedStates.","Verify the persistence unit name passed to PreconfiguredServiceRegistryBuilder refers to a blocking PU, not the reactive one.","Split the application into separate PUs: a blocking PU for ORM and a reactive PU for Hibernate Reactive, and boot each with its matching builder."],"exampleFix":"// before\nPreconfiguredServiceRegistryBuilder b = new PreconfiguredServiceRegistryBuilder(\"reactive-pu\", reactiveRecordedState, puConfig);\n// after\n// boot the blocking PU instead, or use the reactive registry builder for reactive states\nPreconfiguredServiceRegistryBuilder b = new PreconfiguredServiceRegistryBuilder(\"blocking-pu\", blockingRecordedState, puConfig);","handlingStrategy":"type-guard","validationCode":"// Before constructing the blocking registry builder\nif (recordedState.isReactive()) {\n    throw new IllegalStateException(\"Use the reactive registry builder for this RecordedState\");\n}","typeGuard":"boolean isBlockingRecordedState(RecordedState rs) {\n    return rs != null && !rs.isReactive();\n}","tryCatchPattern":"try {\n    new PreconfiguredServiceRegistryBuilder(puName, rs, puConfig);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Reactive RecordedState\")) {\n        log.error(\"PU \" + puName + \" is reactive; use the reactive bootstrap path\");\n    }\n}","preventionTips":["Match registry builder type to the RecordedState's reactive flag","Keep blocking and reactive PUs clearly separated by name","Do not reuse reactive RecordedStates for blocking SessionFactory boot"],"tags":["hibernate-orm","hibernate-reactive","recorded-state","reactive"],"backgroundTag":"reactive-blocking-mismatch","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"}