{"record":{"id":"63d359740b28ade3","repo":"flowable/flowable-engine","slug":"couldn-t-open-resource-stream-message","errorCode":null,"errorMessage":"couldn't open resource stream: ${message}","messagePattern":"couldn't open resource stream: (.+?)","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/ProcessEngines.java","lineNumber":179,"sourceCode":"            processEngineInfosByName.put(processEngineName, processEngineInfo);\n        } catch (Throwable e) {\n            LOGGER.error(\"Exception while initializing process engine: {}\", e.getMessage(), e);\n            processEngineInfo = new ProcessEngineInfoImpl(null, resourceUrlString, ExceptionUtils.getStackTrace(e));\n        }\n        processEngineInfosByResourceUrl.put(resourceUrlString, processEngineInfo);\n        processEngineInfos.add(processEngineInfo);\n        return processEngineInfo;\n    }\n\n    private static ProcessEngine buildProcessEngine(URL resource) {\n        InputStream inputStream = null;\n        try {\n            inputStream = resource.openStream();\n            ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(inputStream);\n            return processEngineConfiguration.buildProcessEngine();\n\n        } catch (IOException e) {\n            throw new ActivitiIllegalArgumentException(\"couldn't open resource stream: \" + e.getMessage(), e);\n        } finally {\n            IoUtil.closeSilently(inputStream);\n        }\n    }\n\n    /**\n     * Get initialization results.\n     */\n    public static List<ProcessEngineInfo> getProcessEngineInfos() {\n        return processEngineInfos;\n    }\n\n    /**\n     * Get initialization results. Only info will we available for process engines which were added in the {@link ProcessEngines#init()}. No {@link ProcessEngineInfo} is available for engines which\n     * were registered programmatically.\n     */\n    public static ProcessEngineInfo getProcessEngineInfo(String processEngineName) {\n        return processEngineInfosByName.get(processEngineName);","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/ProcessEngines.java#L161-L197","documentation":"buildProcessEngine opens the flowable.cfg.xml URL stream to construct the engine; if openStream throws IOException the initializer throws this ActivitiIllegalArgumentException with the IO error message. The resource URL existed but its content could not be read.","triggerScenarios":"A flowable.cfg.xml URL found on the classpath (e.g. inside a JAR, remote URL, or file that vanished) cannot be opened via resource.openStream().","commonSituations":"Corrupted or partially deployed JARs containing flowable.cfg.xml; files deleted between discovery and read; unreadable permissions; network classpath resources going offline.","solutions":["Verify the JAR/directory containing flowable.cfg.xml is intact and readable (unzip -t)","Re-deploy the application artifact containing the config file","Check file permissions and that the resource is not on an unreachable remote classpath entry","Load the engine explicitly from a filesystem path you control to bypass the failing classpath entry"],"exampleFix":"// before\nProcessEngine engine = ProcessEngines.getDefaultProcessEngine(); // fails reading bad classpath entry\n// after\nProcessEngine engine = ProcessEngineConfiguration\n    .createProcessEngineConfigurationFromResource(\"/etc/app/flowable.cfg.xml\")\n    .buildProcessEngine();","handlingStrategy":"validation","validationCode":"URL cfg = getClass().getClassLoader().getResource(\"flowable.cfg.xml\");\ntry (InputStream in = cfg.openStream()) {\n  if (in.read() == -1) throw new IllegalStateException(\"flowable.cfg.xml is empty/unreadable\");\n} catch (IOException e) {\n  throw new IllegalStateException(\"config resource unreadable: \" + cfg, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  engine = ProcessEngines.getDefaultProcessEngine();\n} catch (ActivitiIllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"couldn't open resource stream\"))\n    engine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(\"flowable.cfg.xml\").buildProcessEngine();\n  else throw e;\n}","preventionTips":["Verify JAR integrity (unzip -t) after build/deploy","Ensure config files are readable by the process user","Avoid remote/network classpath entries for engine config","Load config from an explicit filesystem path in containers"],"tags":["classpath","file-read","initialization","flowable"],"backgroundTag":"file-read-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"}