{"record":{"id":"012fa7c1bccf43d7","repo":"flowable/flowable-engine","slug":"resource-resource-not-found-012fa7","errorCode":null,"errorMessage":"resource '${resource}' not found","messagePattern":"resource '(.+?)' not found","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java","lineNumber":79,"sourceCode":"            throw new FlowableException(\"could not get byte array from resource '\" + resourceName + \"'\", e);\n        }\n\n        if (bytes == null) {\n            throw new FlowableException(\"byte array for resource '\" + resourceName + \"' is null\");\n        }\n\n        EventResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(bytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public EventDeploymentBuilder addClasspathResource(String resource) {\n        try (final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resource)) {\n            if (inputStream == null) {\n                throw new FlowableException(\"resource '\" + resource + \"' not found\");\n            }\n            return addInputStream(resource, inputStream);\n            \n        } catch (IOException ex) {\n            throw new FlowableException(\"Failed to read resource \" + resource, ex);\n        }\n    }\n\n    @Override\n    public EventDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        EventResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));\n        deployment.addResource(resource);","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java#L61-L97","documentation":"EventDeploymentBuilderImpl.addClasspathResource resolves a resource from the classloader. If getResourceAsStream returns null — the resource does not exist on the classpath — this FlowableException is thrown so the deployment fails fast with a clear message instead of a downstream null-stream error.","triggerScenarios":"addClasspathResource(\"path/to/event-definition.json\") where no file at that classpath path exists in the application's classloader (wrong name, wrong directory, not on the runtime classpath, or missing file extension).","commonSituations":"Deploying event definitions from src/main/resources but the file name in code has a typo or wrong case (classpath lookup is case-sensitive); file not included in the built jar/WAR; resource placed in a module not on the runtime classpath; resource under a directory excluded from packaging.","solutions":["Correct the resource path in addClasspathResource, matching exactly (case-sensitive, including folders and extension) a file present in src/main/resources or the runtime classpath","Verify the built artifact (jar/WAR) actually contains the resource (unzip and check, or getResource(...)!=null test at runtime)","If the resource is optional or external, load via File/absolute path instead of classpath, guarding existence first"],"exampleFix":"// before\ndeploymentBuilder.addClasspathResource(\"event/my-event.json\"); // actual path: events/my-event.json\n// after\ndeploymentBuilder.addClasspathResource(\"events/my-event.json\");","handlingStrategy":"validation","validationCode":"String path = \"events/my-event.json\";\nif (getClass().getClassLoader().getResource(path) == null) {\n    throw new IllegalArgumentException(\"Classpath resource missing: \" + path);\n}\ndeploymentBuilder.addClasspathResource(path);","typeGuard":"boolean resourceExists = getClass().getClassLoader().getResource(resource) != null;","tryCatchPattern":"try {\n    deploymentBuilder.addClasspathResource(resource);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"not found\")) {\n        // correct the classpath path or add the resource to the build\n    } else { throw e; }\n}","preventionTips":["Match resource paths exactly, including case and directories","Verify resources are packaged into the final jar/WAR","Add a startup check that all event definition resources resolve before deploying"],"tags":["flowable","deployment","classpath","resource-not-found"],"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"}