{"record":{"id":"45fddc1db39cd46b","repo":"quarkusio/quarkus","slug":"this-method-is-not-available-at-runtime-in-quarkus","errorCode":null,"errorMessage":"This method is not available at runtime in Quarkus","messagePattern":"This method is not available at runtime in Quarkus","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java","lineNumber":261,"sourceCode":"        @Override\n        public void sessionFactoryClosed(SessionFactory sessionFactory) {\n            SessionFactoryImplementor sfi = ((SessionFactoryImplementor) sessionFactory);\n            sfi.getServiceRegistry().destroy();\n            ServiceRegistry basicRegistry = sfi.getServiceRegistry().getParentServiceRegistry();\n            ((ServiceRegistryImplementor) basicRegistry).destroy();\n        }\n    }\n\n    private static class JpaEntityNotFoundDelegate implements EntityNotFoundDelegate, Serializable {\n\n        public void handleEntityNotFound(String entityName, Object id) {\n            throw new EntityNotFoundException(\"Unable to find \" + entityName + \" with id \" + id);\n        }\n    }\n\n    @Override\n    public ManagedResources getManagedResources() {\n        throw new IllegalStateException(\"This method is not available at runtime in Quarkus\");\n    }\n\n    @Override\n    public MetadataImplementor metadata() {\n        return metadata;\n    }\n\n}\n","sourceCodeStart":243,"sourceCodeEnd":270,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java#L243-L270","documentation":"FastBootEntityManagerFactoryBuilder.getManagedResources() intentionally refuses to return ManagedResources at runtime. In Quarkus, Hibernate metadata is fully built at augmentation (compile) time, so the runtime EntityManagerFactoryBuilder stub cannot expose the raw resources Hibernate would normally carry. Any code (usually a Hibernate integration or third-party extension) asking for them hits this hard stop.","triggerScenarios":"Calling getManagedResources() on the FastBootEntityManagerFactoryBuilder instance used for a Quarkus-managed persistence unit — typically from custom Hibernate integrators, tools, or tests that inspect ManagedResources at runtime.","commonSituations":"Porting plain-Hibernate bootstrap code to Quarkus; writing an extension or integrator that reads ManagedResources; running Hibernate tooling (schema export utilities, metadata analyzers) against the runtime bootstrap.","solutions":["Do not call getManagedResources() at runtime; use metadata() instead, which returns the pre-built MetadataImplementor.","If you need ManagedResources, access them at augmentation/build time in a deployment module build step, not at runtime.","Refactor the calling integrator/tool to rely on metadata or service registry data Quarkus does provide."],"exampleFix":"// before\nManagedResources resources = emfBuilder.getManagedResources();\n// after\nMetadataImplementor metadata = emfBuilder.metadata(); // safe at runtime in Quarkus","handlingStrategy":"try-catch","validationCode":"// Before calling, prefer the metadata accessor which is supported at runtime\nif (builder instanceof FastBootEntityManagerFactoryBuilder) {\n    // do NOT call getManagedResources(); use metadata()\n}","typeGuard":"boolean supportsManagedResources(Object b) {\n    return !(b instanceof FastBootEntityManagerFactoryBuilder);\n}","tryCatchPattern":"try {\n    ManagedResources r = builder.getManagedResources();\n} catch (IllegalStateException e) {\n    // fall back to builder.metadata() for runtime inspection\n    MetadataImplementor md = builder.metadata();\n}","preventionTips":["Never call getManagedResources() on Quarkus runtime bootstrap objects","Use metadata() for runtime metadata inspection","Access ManagedResources only in deployment-time build steps"],"tags":["hibernate-orm","quarkus","unsupported-operation","static-init"],"backgroundTag":"runtime-unavailable","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"}