{"record":{"id":"38da6e11b7d00ca7","repo":"flowable/flowable-engine","slug":"resource-resource-doesn-t-exist-38da6e","errorCode":null,"errorMessage":"resource '${resource}' doesn't exist","messagePattern":"resource '(.+?)' doesn't exist","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/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 FlowableIllegalArgumentException(\"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/flowable-engine/src/main/java/org/flowable/engine/impl/util/io/ResourceStreamSource.java#L31-L59","documentation":"ResourceStreamSource.getInputStream locates a classpath resource via the given (or default) ClassLoader. When the resource cannot be found, it throws this FlowableIllegalArgumentException, since a stream source pointing at a missing classpath entry is an invalid configuration.","triggerScenarios":"Creating a ResourceStreamSource (directly or via configuration expecting a classpath resource) with a resource path that does not exist on the classpath; getInputStream then returns null from classLoader.getResourceAsStream(resource).","commonSituations":"Typos in the resource path; the file exists on the filesystem but not on the classpath (missing from src/main/resources); resource excluded by build filters; wrong ClassLoader in OSGi/app-server deployments.","solutions":["Verify the resource path exists under src/main/resources (or another classpath root) and matches exactly, case included.","Rebuild/redeploy so the resource is packaged in the artifact (check the jar contents).","Use ReflectUtil.getResourceAsStream with the correct ClassLoader, or pass an explicit ClassLoader that can see the resource.","If the resource is optional, check availability first via classLoader.getResource(resource) before constructing the stream source."],"exampleFix":"// before\nStreamSource src = new ResourceStreamSource(\"config/rules.xml\");\nInputStream in = src.getInputStream();\n// after\nString res = \"config/rules.xml\";\nif (getClass().getClassLoader().getResource(res) == null) {\n    throw new IllegalArgumentException(\"Missing classpath resource: \" + res);\n}\nInputStream in = getClass().getClassLoader().getResourceAsStream(res);","handlingStrategy":"validation","validationCode":"String res = \"config/rules.xml\";\nif (getClass().getClassLoader().getResource(res) == null) throw new IllegalStateException(\"Classpath resource missing: \" + res);","typeGuard":"boolean resourceExists(String res, ClassLoader cl) { return (cl != null ? cl : Thread.currentThread().getContextClassLoader()).getResource(res) != null; }","tryCatchPattern":"try { in = streamSource.getInputStream(); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains(\"doesn't exist\")) log.error(\"Missing classpath resource: {}\", e.getMessage()); else throw e; }","preventionTips":["Keep resource files under src/main/resources and reference them by exact classpath path","Check packaged jar contents when resources vanish after builds","Verify ClassLoader visibility in app-server/OSGi environments"],"tags":["flowable","classpath","resource-not-found","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-14T05:17:10.506Z"}