{"record":{"id":"f4c698abf0e80205","repo":"flowable/flowable-engine","slug":"dmn-engine-has-not-been-initialized","errorCode":null,"errorMessage":"DMN engine has not been initialized","messagePattern":"DMN engine has not been initialized","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/dmn/DmnEngineServicesAutoConfiguration.java","lineNumber":71,"sourceCode":"\n    /**\n     * If a process engine is present that means that the DmnEngine was created as part of it.\n     * Therefore extract it from the DmnEngines.\n     */\n    @Configuration(proxyBeanMethods = false)\n    @ConditionalOnMissingBean(type = {\n        \"org.flowable.dmn.engine.DmnEngine\",\n        \"org.flowable.app.engine.AppEngine\"\n    })\n    @ConditionalOnBean(type = {\n        \"org.flowable.engine.ProcessEngine\"\n    })\n    static class AlreadyInitializedEngineConfiguration {\n        @Bean\n        public DmnEngine dmnEngine(@SuppressWarnings(\"unused\") ProcessEngine processEngine) {\n            // The process engine needs to be injected, as otherwise it won't be initialized, which means that the DmnEngine is not initialized yet\n            if (!DmnEngines.isInitialized()) {\n                throw new IllegalStateException(\"DMN engine has not been initialized\");\n            }\n            return DmnEngines.getDefaultDmnEngine();\n        }\n    }\n    \n    /**\n     * If an app engine is present that means that the DmnEngine was created as part of the app engine.\n     * Therefore extract it from the DmnEngines.\n     */\n    @Configuration(proxyBeanMethods = false)\n    @ConditionalOnMissingBean(type = {\n        \"org.flowable.dmn.engine.DmnEngine\"\n    })\n    @ConditionalOnBean(type = {\n        \"org.flowable.app.engine.AppEngine\"\n    })\n    static class AlreadyInitializedAppEngineConfiguration {\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/dmn/DmnEngineServicesAutoConfiguration.java#L53-L89","documentation":"During Spring Boot auto-configuration, Flowable exposes the already-initialized DMN engine as a bean by fetching it from the DmnEngines static registry. If the DMN engine has not been initialized by the time this @Bean method runs, the registry has no default engine and this IllegalStateException is thrown. It is a startup-order guard: the injected ProcessEngine is expected to have bootstrapped the DMN engine.","triggerScenarios":"Spring Boot auto-configuration selects AlreadyInitializedEngineConfiguration and the dmnEngine(ProcessEngine) bean method runs while DmnEngines.isInitialized() is false — i.e. the ProcessEngine (or standalone DMN engine) was never built before this bean was requested.","commonSituations":"Mixing flowable-spring-boot starters with manual engine configuration; disabling the ProcessEngine auto-configuration while keeping DMN bean exposure; custom bean definitions that build engines lazily or in the wrong order; excluding the engine initializer beans.","solutions":["Ensure a ProcessEngine (flowable-spring-boot-starter-process) is on the classpath and auto-configured so it initializes the DMN engine before this bean method runs","Let Flowable build the DMN engine itself: use the standard DmnEngineConfiguration bean instead of relying on the 'already-initialized' path","Check for @ConditionalOnMissingBean overrides or exclusions (e.g. spring.autoconfigure.exclude) that suppress engine initialization","Initialize the DMN engine explicitly in a BeanFactoryPostProcessor/early bean so DmnEngines.isInitialized() is true"],"exampleFix":"// before: custom bean created before engine init\n@Bean DmnEngine dmnEngine() { return DmnEngines.getDefaultDmnEngine(); }\n// after: depend on process engine so init order is guaranteed\n@Bean DmnEngine dmnEngine(ProcessEngine processEngine) {\n    if (!DmnEngines.isInitialized()) throw new IllegalStateException(\"...\");\n    return DmnEngines.getDefaultDmnEngine();\n}","handlingStrategy":"validation","validationCode":"if (!DmnEngines.isInitialized()) { throw new IllegalStateException(\"Start the ProcessEngine before requesting the DmnEngine bean\"); }","typeGuard":"boolean dmnAvailable = DmnEngines.isInitialized();","tryCatchPattern":"try { return DmnEngines.getDefaultDmnEngine(); } catch (IllegalStateException e) { /* fall back to building a DmnEngine locally */ }","preventionTips":["Always include the process/app engine starter when using the already-initialized engine beans","Do not exclude Flowable engine auto-configurations selectively","Check engine init order in integration tests","Watch startup logs for earlier engine init failures"],"tags":["spring-boot","engine-initialization","startup"],"backgroundTag":"module-init-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}