{"record":{"id":"b51a132a1d7c6fa4","repo":"flowable/flowable-engine","slug":"resource-resource-not-found-b51a13","errorCode":null,"errorMessage":"resource '${resource}' not found","messagePattern":"resource '(.+?)' not found","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java","lineNumber":82,"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        DmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(bytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public DmnDeploymentBuilder 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 DmnDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        DmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));\n        deployment.addResource(resource);","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java#L64-L100","documentation":"DmnDeploymentBuilderImpl.addClasspathResource loads a DMN resource from the classpath via ClassLoader.getResourceAsStream. This FlowableException is thrown when the classloader returns null, meaning no resource exists at the given path on the classpath. The library treats a missing classpath resource as an unrecoverable deployment-time error and aborts the deployment build immediately.","triggerScenarios":"Calling dmnRepositoryService.createDeployment().addClasspathResource(path) where 'path' is not present on the runtime classpath — wrong relative path (missing leading '/' or wrong directory), typo in file name, or the DMN XML file was never copied into src/main/resources (so it is absent from the jar/war).","commonSituations":"Maven/Gradle resources directory misconfiguration (files outside src/main/resources), packaging the engine in a shaded jar that excludes .dmn/.xml resources, renaming a DMN file without updating deployment code, running tests where test resources are not on the classpath, or case-sensitivity differences on Linux servers vs Windows dev machines.","solutions":["Verify the resource path exactly matches the classpath-relative location (e.g. 'dmn/simple.dmn' for src/main/resources/dmn/simple.dmn) and fix the string.","Confirm the file exists under src/main/resources so the build copies it into the artifact; run a clean build.","Inspect the packaged jar/war (jar tf app.jar | grep <resource>) to confirm the resource was bundled.","If the resource lives in a different module/jar, ensure that dependency is on the runtime classpath."],"exampleFix":"// before\nDmnDeploymentBuilder builder = dmnRepositoryService.createDeployment()\n    .addClasspathResource(\"dmn/MyDecision.dmn\"); // file actually at dmn/my-decision.dmn\n// after\nDmnDeploymentBuilder builder = dmnRepositoryService.createDeployment()\n    .addClasspathResource(\"dmn/my-decision.dmn\");","handlingStrategy":"validation","validationCode":"String resource = \"dmn/my-decision.dmn\";\nif (getClass().getClassLoader().getResource(resource) == null) {\n    throw new IllegalStateException(\"Classpath resource missing: \" + resource);\n}","typeGuard":null,"tryCatchPattern":"try {\n    dmnRepositoryService.createDeployment().addClasspathResource(resource).deploy();\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"not found\")) {\n        throw new DeploymentConfigurationException(\"DMN resource not on classpath: \" + resource, e);\n    }\n    throw e;\n}","preventionTips":["Keep DMN files under src/main/resources and reference them with classpath-relative paths.","Verify packaged artifacts with 'jar tf' during CI to catch missing resources before runtime.","Watch out for case-sensitivity in resource names across OSes."],"tags":["java","flowable","classpath","resource-not-found","deployment"],"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"}