{"record":{"id":"a5a6c13f67a943d7","repo":"hibernate/hibernate-orm","slug":"can-t-reactivate-an-active-registry","errorCode":null,"errorMessage":"Can't reactivate an active registry","messagePattern":"Can't reactivate an active registry","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/registry/internal/StandardServiceRegistryImpl.java","lineNumber":121,"sourceCode":"\t\t}\n\t\tcatch (RuntimeException e) {\n\t\t\tvisitServiceBindings( binding -> binding.getLifecycleOwner().stopService( binding ) );\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\t/**\n\t * Not intended for general use. We need the ability to stop and \"reactivate\" a registry\n\t * to allow experimentation with technologies such as GraalVM, Quarkus and Cri-O.\n\t */\n\t@Internal\n\tpublic synchronized void resetAndReactivate(\n\t\t\tBootstrapServiceRegistry bootstrapServiceRegistry,\n\t\t\tList<StandardServiceInitiator<?>> serviceInitiators,\n\t\t\tList<ProvidedService<?>> providedServices,\n\t\t\tMap<?, ?> configurationValues) {\n\t\tif ( super.isActive() ) {\n\t\t\tthrow new IllegalStateException( \"Can't reactivate an active registry\" );\n\t\t}\n\t\tsuper.resetParent( bootstrapServiceRegistry );\n\t\tthis.configurationValues = new HashMap( configurationValues );\n\t\tsuper.reactivate();\n\t\tapplyServiceRegistrations( serviceInitiators, providedServices );\n\t}\n\n\n\t@Override\n\tpublic synchronized <R extends Service> R initiateService(ServiceInitiator<R> serviceInitiator) {\n\t\t// todo : add check/error for unexpected initiator types?\n\t\treturn ( (StandardServiceInitiator<R>) serviceInitiator ).initiateService( configurationValues, this );\n\t}\n\n\t@Override\n\tpublic synchronized <R extends Service> void configureService(ServiceBinding<R> serviceBinding) {\n\t\tif ( serviceBinding.getService() instanceof Configurable configurable ) {\n\t\t\tconfigurable.configure( configurationValues );","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/registry/internal/StandardServiceRegistryImpl.java#L103-L139","documentation":"resetAndReactivate() is an @Internal method that lets a stopped StandardServiceRegistry be revived for experimentation with GraalVM/Quarkus-style boot. It refuses to run while the registry is still active - reactivating live service state would corrupt it - so isActive() == true yields IllegalStateException before any state is touched.","triggerScenarios":"Framework boot code (Quarkus dev-mode restarts, native-image bootstraps, custom restart logic) calling resetAndReactivate() without a prior successful stop/destroy of the registry - typically because an earlier shutdown failed, was skipped, or raced with the restart.","commonSituations":"Quarkus dev-mode/hot-reload restart sequences; custom bootstraps that reuse one registry across restarts; exceptions during a previous close leaving the registry marked active.","solutions":["Ensure the registry is fully stopped (destroy()) before resetAndReactivate(), and investigate why the prior shutdown did not happen","Prefer building a fresh StandardServiceRegistry per restart instead of reactivating the old one","Do not call @Internal APIs from application code; upgrade the framework (Quarkus/Hibernate) where restart sequencing is fixed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only reactivate a registry that is actually stopped\nif (registry.isActive()) {\n    registry.destroy(); // or skip reactivation entirely and build a fresh registry\n}\nregistry.resetAndReactivate(boot, initiators, provided, config);","typeGuard":null,"tryCatchPattern":"try {\n    registry.resetAndReactivate(...);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"reactivate an active registry\")) {\n        // previous shutdown never completed: fall back to a freshly built registry\n    }\n    throw e;\n}","preventionTips":["Do not call @Internal registry APIs from application code; leave them to frameworks","Before any restart sequence, verify the prior destroy() completed (isActive() == false)","Prefer building a new StandardServiceRegistry per restart over reactivating an old one"],"tags":["hibernate","internal-api","service-registry","quarkus","graalvm","lifecycle"],"backgroundTag":"invalid-lifecycle-transition","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}