flowable/flowable-engine · error · FlowableException

inputStream for resource '${resourceName}' is null

Error message

inputStream for resource '${resourceName}' is null

What it means

CmmnDeploymentBuilderImpl.addInputStream throws FlowableException with "inputStream for resource '<resourceName>' is null" when a null InputStream is registered as a deployment resource. The builder reads the whole stream into bytes immediately, so a null stream cannot be processed and deployment must abort.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java:52

    protected transient CmmnRepositoryServiceImpl repositoryService;
    protected transient CmmnResourceEntityManager resourceEntityManager;

    protected CmmnDeploymentEntity deployment;
    protected boolean isCmmn20XsdValidationEnabled = true;
    protected boolean isDuplicateFilterEnabled;

    public CmmnDeploymentBuilderImpl() {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration();
        this.repositoryService = (CmmnRepositoryServiceImpl) cmmnEngineConfiguration.getCmmnRepositoryService();
        this.deployment = cmmnEngineConfiguration.getCmmnDeploymentEntityManager().create();
        this.resourceEntityManager = cmmnEngineConfiguration.getCmmnResourceEntityManager();
    }

    @Override
    public CmmnDeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
        if (inputStream == null) {
            throw new FlowableException("inputStream for resource '" + resourceName + "' is null");
        }

        byte[] bytes = null;
        try {
            bytes = IoUtil.readInputStream(inputStream, resourceName);
        } catch (Exception e) {
            throw new FlowableException("could not get byte array from resource '" + resourceName + "'", e);
        }

        if (bytes == null) {
            throw new FlowableException("byte array for resource '" + resourceName + "' is null");
        }

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

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the resource name/path is correct and that the file exists on the classpath before adding it.
  2. Check that the InputStream-producing code (e.g. getClass().getResourceAsStream) is null-checked and that the stream is not closed/never opened.
  3. If reading from a file, prefer repositoryService createDeployment().addClasspathResource(...) with a verified path or addInputStream over a FileInputStream you confirmed exists.

Example fix

// before
InputStream is = getClass().getResourceAsStream(resourcePath);
builder.addInputStream(resourcePath, is); // NPE-safe but throws here

// after
InputStream is = getClass().getResourceAsStream(resourcePath);
if (is == null) {
    throw new IllegalStateException("resource not on classpath: " + resourcePath);
}
builder.addInputStream(resourcePath, is);
Defensive patterns

Strategy: validation

Validate before calling

InputStream is = getClass().getResourceAsStream(path);
if (is == null) {
    throw new IllegalStateException("resource missing on classpath: " + path);
}
builder.addInputStream(path, is);

Type guard

boolean resourceExists(String path) {
    return getClass().getResource(path) != null;
}

Try / catch

try {
    builder.addInputStream(name, is);
} catch (FlowableException e) {
    if (!e.getMessage().contains("is null")) throw e;
    throw new DeploymentException("resource stream missing: " + name, e);
}

Prevention

When it happens

Trigger: Calling addInputStream(name, null) directly, or indirectly via addClasspathResource when the classpath resource does not exist (getResourceAsStream returns null).

Common situations: Typo in the classpath resource path; resource not included in the build/jar; file was moved or renamed; loading from a wrong classloader (e.g. different WAR/module).

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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