flowable/flowable-engine · error · FlowableException

Failed to read resource ${resource}

Error message

Failed to read resource ${resource}

What it means

DmnDeploymentBuilderImpl.addClasspathResource wraps its classloader read in try-with-resources; if closing/reading the stream raises IOException, it rethrows as FlowableException('Failed to read resource ' + resource, ex). Unlike the null-stream case, the resource WAS found but the underlying stream could not be read successfully.

Source

Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/repository/DmnDeploymentBuilderImpl.java:87

        }

        DmnResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(bytes);
        deployment.addResource(resource);
        return this;
    }

    @Override
    public DmnDeploymentBuilder addClasspathResource(String resource) {
        try (final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resource)) {
            if (inputStream == null) {
                throw new FlowableException("resource '" + resource + "' not found");
            }
            return addInputStream(resource, inputStream);
            
        } catch (IOException ex) {
            throw new FlowableException("Failed to read resource " + resource, ex);
        }
    }

    @Override
    public DmnDeploymentBuilder addString(String resourceName, String text) {
        if (text == null) {
            throw new FlowableException("text is null");
        }

        DmnResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));
        deployment.addResource(resource);
        return this;
    }

    @Override
    public DmnDeploymentBuilder addDmnBytes(String resourceName, byte[] dmnBytes) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the wrapped IOException cause (ex.getCause()) to find the real read failure and fix the underlying stream/jar problem.
  2. Rebuild and redeploy the artifact — a corrupted or partially written jar entry is the most common root cause.
  3. Test reading the resource directly (getClass().getClassLoader().getResourceAsStream(resource).read()) to reproduce outside the deployment builder.
  4. If a custom classloader or app-server classloading delegation is involved, add the resource to a parent/visible classpath location.

Example fix

// before
try {
    dmnRepositoryService.createDeployment().addClasspathResource("dmn/decision.dmn").deploy();
} catch (FlowableException e) {
    log.error(e.getMessage()); // swallows the root cause
}
// after
try {
    dmnRepositoryService.createDeployment().addClasspathResource("dmn/decision.dmn").deploy();
} catch (FlowableException e) {
    log.error("DMN deployment failed", e); // inspect the IOException cause
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    dmnRepositoryService.createDeployment().addClasspathResource(resource).deploy();
} catch (FlowableException e) {
    if (e.getCause() instanceof IOException) {
        throw new DeploymentIoException("Could not read DMN resource " + resource + ": " + e.getCause().getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling addClasspathResource where getResourceAsStream returns a valid stream but reading or closing it throws IOException — e.g. the resource is backed by a defective jar entry, a corrupt classpath jar, an interrupted/closed underlying stream, or a custom classloader whose stream fails on read.

Common situations: Corrupted jars in the application server's lib directory, partially-built artifacts, custom classloading setups in application servers (WebSphere/WebLogic) that return failing streams, or file-system issues with exploded classpath directories (permissions, NFS mount dropouts).

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/15f295589fb8d3e5. Report an issue: GitHub.