{"record":{"id":"60b2e2cb4f2c6870","repo":"flowable/flowable-engine","slug":"couldn-t-initialize-event-registry-engine-from-spr","errorCode":null,"errorMessage":"couldn't initialize event registry engine from spring configuration resource ","messagePattern":"couldn't initialize event registry engine from spring configuration resource ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"critical","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/EventRegistryEngines.java","lineNumber":106,"sourceCode":"            setInitialized(true);\n        } else {\n            LOGGER.info(\"Event registry engines already initialized\");\n        }\n    }\n\n    protected static void initEventRegistryEngineFromSpringResource(URL resource) {\n        try {\n            Class<?> springConfigurationHelperClass = ReflectUtil.loadClass(\"org.flowable.eventregistry.impl.spring.SpringEventRegistryConfigurationHelper\");\n            Method method = springConfigurationHelperClass.getDeclaredMethod(\"buildEventRegistryEngine\", new Class<?>[] { URL.class });\n            EventRegistryEngine eventRegistryEngine = (EventRegistryEngine) method.invoke(null, new Object[] { resource });\n\n            String eventRegistryEngineName = eventRegistryEngine.getName();\n            EngineInfo eventRegistryEngineInfo = new EngineInfo(eventRegistryEngineName, resource.toString(), null);\n            eventRegistryEngineInfosByName.put(eventRegistryEngineName, eventRegistryEngineInfo);\n            eventRegistryEngineInfosByResourceUrl.put(resource.toString(), eventRegistryEngineInfo);\n\n        } catch (Exception e) {\n            throw new FlowableException(\"couldn't initialize event registry engine from spring configuration resource \" + resource + \": \" + e.getMessage(), e);\n        }\n    }\n\n    /**\n     * Registers the given event registry engine. No {@link EngineInfo} will be available for this event registry engine. An engine that is registered will be closed when the {@link EventRegistryEngines#destroy()} is called.\n     */\n    public static void registerEventRegistryEngine(EventRegistryEngine eventRegistryEngine) {\n        eventRegistryEngines.put(eventRegistryEngine.getName(), eventRegistryEngine);\n    }\n\n    /**\n     * Unregisters the given event registry engine.\n     */\n    public static void unregister(EventRegistryEngine eventRegistryEngine) {\n        eventRegistryEngines.remove(eventRegistryEngine.getName());\n    }\n\n    private static EngineInfo initEventRegistryEngineFromResource(URL resourceUrl) {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/EventRegistryEngines.java#L88-L124","documentation":"Flowable throws this when building an Event Registry engine from a Spring configuration XML resource fails. initEventRegistryEngineFromSpringResource parses the resource into an EventRegistryEngineConfiguration; any exception (parse error, bean wiring failure, DB failure during buildEventRegistryEngine) is wrapped in a FlowableException with the resource URL and root cause message appended. It is a fatal engine bootstrap failure.","triggerScenarios":"Calling EventRegistryEngines.init() (directly or via Spring engine auto-init) with flowable.eventregistry.cfg.xml-style Spring resources where the XML is malformed, references missing beans/classes, or the engine build inside the config fails (e.g. database unreachable, invalid datasource).","commonSituations":"Typo or wrong schema in the Spring config XML; datasource bean misconfigured or DB down at startup; missing flowable-event-registry-spring jar so a referenced class is absent; resource URL resolves to a stale/empty file.","solutions":["Read the chained cause (e.getMessage() part) to find the real failure: XML parse error, missing bean, or DB connection failure","Validate the Spring XML resource parses standalone (e.g. load it with ClassPathXmlApplicationContext in a test)","Verify the datasource and database are reachable before engine init","Ensure the flowable-event-registry-spring module and all bean classes referenced in the XML are on the classpath"],"exampleFix":"// before\n<bean id=\"eventRegistryEngineConfiguration\" class=\"org.flowable.eventregistry.spring.config.EventRegistryEngineConfiguration\">\n  <property name=\"dataSource\" ref=\"dtaSource\" /> <!-- typo -->\n</bean>\n// after\n<bean id=\"eventRegistryEngineConfiguration\" class=\"org.flowable.eventregistry.spring.config.EventRegistryEngineConfiguration\">\n  <property name=\"dataSource\" ref=\"dataSource\" />\n</bean>","handlingStrategy":"try-catch","validationCode":"// before init: sanity-check the Spring resource\ntry (InputStream is = getClass().getResourceAsStream(\"/flowable-eventregistry.cfg.xml\")) {\n    if (is == null) throw new IllegalStateException(\"event registry spring config missing\");\n    new javax.xml.parsers.DocumentBuilderFactory().newInstance().newDocumentBuilder().parse(is); // well-formed?\n}","typeGuard":"boolean isUsableUrl(URL u) { return u != null && (\"file\".equals(u.getProtocol()) ? new java.io.File(u.getPath()).canRead() : true); }","tryCatchPattern":"try {\n    EventRegistryEngines.init();\n} catch (FlowableException e) {\n    LOGGER.error(\"Event registry engine init failed: {}\", e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), e);\n    throw new IllegalStateException(\"abort startup: event registry not initialized\", e);\n}","preventionTips":["Always log/log-unwrap the root cause; the message string only summarizes it","Validate the Spring XML in CI with a smoke test that boots the engine","Keep datasource config verified before engine init (connection test)","Pin the flowable-event-registry-spring version to the engine version"],"tags":["flowable","spring","engine-init","configuration"],"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-14T05:17:10.506Z"}