flowable/flowable-engine · error · ActivitiIllegalArgumentException

resourceName is null

Error message

resourceName is null

What it means

GetDeploymentResourceCmd.execute validates resourceName and throws ActivitiIllegalArgumentException when it is null. Resources inside a deployment are addressed by name, so a null name cannot be resolved.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetDeploymentResourceCmd.java:46

 */
public class GetDeploymentResourceCmd implements Command<InputStream>, Serializable {

    private static final long serialVersionUID = 1L;
    protected String deploymentId;
    protected String resourceName;

    public GetDeploymentResourceCmd(String deploymentId, String resourceName) {
        this.deploymentId = deploymentId;
        this.resourceName = resourceName;
    }

    @Override
    public InputStream execute(CommandContext commandContext) {
        if (deploymentId == null) {
            throw new ActivitiIllegalArgumentException("deploymentId is null");
        }
        if (resourceName == null) {
            throw new ActivitiIllegalArgumentException("resourceName is null");
        }

        ResourceEntity resource = commandContext
                .getResourceEntityManager()
                .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
        if (resource == null) {
            if (commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId) == null) {
                throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class);
            } else {
                throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class);
            }
        }
        return new ByteArrayInputStream(resource.getBytes());
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass the exact resource name as it was added with addInputStream/addClasspathResource during deployment.
  2. Null-check resourceName before the call, or default it to a known constant like "process.bpmn20.xml".
  3. List actual names via repositoryService.getDeploymentResourceNames(deploymentId) and use one of them.

Example fix

// before
InputStream is = repositoryService.getResourceAsStream(deploymentId, resourceName);
// after
if (resourceName == null) {
    resourceName = deploymentId != null
        ? repositoryService.getDeploymentResourceNames(deploymentId).iterator().next()
        : "process.bpmn20.xml";
}
InputStream is = repositoryService.getResourceAsStream(deploymentId, resourceName);
Defensive patterns

Strategy: validation

Validate before calling

if (resourceName == null || resourceName.isEmpty()) {
    throw new IllegalArgumentException("resourceName must be provided");
}

Type guard

boolean hasResourceName(String name) { return name != null && !name.isEmpty(); }

Try / catch

try {
    return repositoryService.getResourceAsStream(deploymentId, resourceName);
} catch (ActivitiIllegalArgumentException e) {
    log.error("Null resourceName passed to getResourceAsStream", e);
    return null;
}

Prevention

When it happens

Trigger: repositoryService.getResourceAsStream(deploymentId, resourceName) with a null resourceName.

Common situations: Resource name read from properties/env that was missing; typo in configuration key; building the name dynamically (e.g. process key + ".bpmn20.xml") when the key is null.

Related errors


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