{"record":{"id":"8654a14c08de1396","repo":"flowable/flowable-engine","slug":"resource-resource-doesn-t-exist-8654a1","errorCode":null,"errorMessage":"resource ' + resource + ' doesn't exist","messagePattern":"resource ' \\+ resource \\+ ' doesn't exist","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/util/io/ResourceStreamSource.java","lineNumber":49,"sourceCode":"    public ResourceStreamSource(String resource) {\n        this.resource = resource;\n    }\n\n    public ResourceStreamSource(String resource, ClassLoader classLoader) {\n        this.resource = resource;\n        this.classLoader = classLoader;\n    }\n\n    @Override\n    public InputStream getInputStream() {\n        InputStream inputStream = null;\n        if (classLoader == null) {\n            inputStream = ReflectUtil.getResourceAsStream(resource);\n        } else {\n            inputStream = classLoader.getResourceAsStream(resource);\n        }\n        if (inputStream == null) {\n            throw new ActivitiIllegalArgumentException(\"resource '\" + resource + \"' doesn't exist\");\n        }\n        return new BufferedInputStream(inputStream);\n    }\n\n    @Override\n    public String toString() {\n        return \"Resource[\" + resource + \"]\";\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":59,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/util/io/ResourceStreamSource.java#L31-L59","documentation":"ResourceStreamSource.getInputStream() resolves a classpath resource via the thread/classloader and throws ActivitiIllegalArgumentException when the resource cannot be found on the classpath (inputStream == null). It means the named resource string does not resolve to an existing classpath entry.","triggerScenarios":"Creating a ResourceStreamSource for resource 'path/file' (with or without explicit classLoader) where getResourceAsStream returns null — the resource is absent from the classpath at runtime.","commonSituations":"Typo in the resource path; resource not packaged into the jar/war (missing from src/main/resources); leading slash misuse (classpath vs filesystem path); resource present in IDE but not in the deployed artifact.","solutions":["Confirm the resource exists under src/main/resources and is packaged in the artifact","Print getClass().getResource(resource) to debug resolution and fix the path (with/without leading slash)","Ensure the jar/war containing the resource is on the runtime classpath","If loading from a filesystem path, use a FileStreamSource instead"],"exampleFix":"// before\nStreamSource src = new ResourceStreamSource(\"bpmn/myProcess.xml\"); // not on classpath\n// after\nStreamSource src = new ResourceStreamSource(\"org/acme/bpmn/myProcess.xml\"); // matches packaged location","handlingStrategy":"validation","validationCode":"// verify the resource resolves before constructing the source\nString path = resource.startsWith(\"/\") ? resource.substring(1) : resource;\nif (Thread.currentThread().getContextClassLoader().getResource(path) == null) {\n  throw new IllegalStateException(\"classpath resource missing: \" + path);\n}","typeGuard":"boolean classpathResourceExists(String resource) {\n  return ReflectUtil.getResourceAsStream(resource) != null;\n}","tryCatchPattern":"try {\n  InputStream in = new ResourceStreamSource(resource).getInputStream();\n} catch (ActivitiIllegalArgumentException e) {\n  logger.error(\"resource not found on classpath: \" + resource, e);\n  // fail fast or load from filesystem fallback\n}","preventionTips":["Keep resources under src/main/resources so they are packaged","Use fully-qualified classpath paths matching the package structure","Verify deployment artifacts contain the resource (unzip the jar)","Use filesystem stream sources for absolute paths, classpath sources for packaged files"],"tags":["classpath","resource","io"],"backgroundTag":"resource-not-found","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"}