{"record":{"id":"f21fd04898454e56","repo":"flowable/flowable-engine","slug":"couldn-t-open-resource-stream-errormessage","errorCode":null,"errorMessage":"couldn't open resource stream: {errorMessage}","messagePattern":"couldn't open resource stream: (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"critical","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/CmmnEngines.java","lineNumber":162,"sourceCode":"            cmmnEngineInfo = new EngineInfo(cmmnEngineName, resourceUrlString, null);\n            cmmnEngines.put(cmmnEngineName, cmmnEngine);\n            cmmnEngineInfosByName.put(cmmnEngineName, cmmnEngineInfo);\n        } catch (Throwable e) {\n            LOGGER.error(\"Exception while initializing cmmn engine: {}\", e.getMessage(), e);\n            cmmnEngineInfo = new EngineInfo(null, resourceUrlString, ExceptionUtils.getStackTrace(e));\n        }\n        cmmnEngineInfosByResourceUrl.put(resourceUrlString, cmmnEngineInfo);\n        cmmnEngineInfos.add(cmmnEngineInfo);\n        return cmmnEngineInfo;\n    }\n\n    protected static CmmnEngine buildCmmnEngine(URL resource) {\n        try (InputStream inputStream = resource.openStream()) {\n            CmmnEngineConfiguration cmmnEngineConfiguration = CmmnEngineConfiguration.createCmmnEngineConfigurationFromInputStream(inputStream);\n            return cmmnEngineConfiguration.buildCmmnEngine();\n\n        } catch (IOException e) {\n            throw new FlowableException(\"couldn't open resource stream: \" + e.getMessage(), e);\n        }\n    }\n\n    /** Get initialization results. */\n    public static List<EngineInfo> getCmmnEngineInfos() {\n        return cmmnEngineInfos;\n    }\n\n    /**\n     * Get initialization results. Only info will we available for cmmn engines which were added in the {@link CmmnEngines#init()}. No {@link EngineInfo} is available for engines which were registered\n     * programmatically.\n     */\n    public static EngineInfo getCmmnEngineInfo(String cmmnEngineName) {\n        return cmmnEngineInfosByName.get(cmmnEngineName);\n    }\n\n    public static CmmnEngine getDefaultCmmnEngine() {\n        return getCmmnEngine(NAME_DEFAULT);","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/CmmnEngines.java#L144-L180","documentation":"Thrown by CmmnEngines.buildCmmnEngine when the configuration resource URL cannot be opened as an InputStream, wrapping the underlying IOException. Flowable uses this during static engine initialization from a resource URL, so the engine fails to start before any configuration is parsed.","triggerScenarios":"Calling CmmnEngines.buildCmmnEngine(URL) (directly or via init/retry paths) with a URL whose openStream() throws IOException: file missing, unreadable, or remote stream failing.","commonSituations":"Typos in flowable.cfg.xml path on classpath; resource deleted after classloader URL was captured; jar packaged without the config file; network filesystem/URL resources unavailable at engine bootstrap.","solutions":["Verify the resource URL points to an existing, readable file (open the URL manually before init)","Ensure flowable.cfg.xml is on the classpath and included in the built artifact/jar","Check filesystem/permissions or network availability of the URL target","Inspect the wrapped IOException cause (e.getCause()) for the real reason"],"exampleFix":"// before\nURL url = new URL(\"file:conf/flowable.cfg.xml\");\nCmmnEngines.buildCmmnEngine(url);\n// after\nURL url = CmmnEngines.class.getClassLoader().getResource(\"flowable.cfg.xml\");\nif (url == null) throw new IllegalStateException(\"flowable.cfg.xml not on classpath\");\ntry (InputStream in = url.openStream()) { /* verify readable */ }\nCmmnEngines.buildCmmnEngine(url);","handlingStrategy":"try-catch","validationCode":"URL url = ClassLoader.getSystemResource(\"flowable.cfg.xml\");\nif (url == null) throw new IllegalStateException(\"config resource missing\");\ntry (InputStream in = url.openStream()) { /* succeeds means openable */ }","typeGuard":null,"tryCatchPattern":"try { engine = CmmnEngines.buildCmmnEngine(url); } catch (FlowableException e) { log.error(\"config resource unopenable: {}\", e.getCause(), e); throw new EngineInitException(e); }","preventionTips":["Package the flowable config file inside the jar/WAR","Resolve resources via ClassLoader.getResource, never hand-built paths","Verify resource readability at startup before engine init"],"tags":["java","configuration","initialization","io"],"backgroundTag":"file-open-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"}