flowable/flowable-engine · error · org.activiti.engine.ActivitiIllegalArgumentException
inputStream for resource
Error message
inputStream for resource '${resourceName}' is null What it means
Thrown by DeploymentBuilderImpl.addInputStream when the provided InputStream argument is null. The deployment builder requires a non-null stream to read the resource bytes before adding it to the deployment. This is argument validation via ActivitiIllegalArgumentException, thrown before any deployment resource is created.
Solutions
- Fix the source of the stream (correct classpath path, existing file) so it isn't null
- Null-check the stream and throw a clear error naming the resource before calling addInputStream
- Use addClasspathResource/addString for resources so a missing file fails with a clearer message
- Log/verify the resource exists in the deployed artifact (JAR/WAR)
Example fix
// before
InputStream is = getClass().getResourceAsStream("proc.bpmn");
repo.createDeployment().addInputStream("proc.bpmn", is).deploy(); // fails if is==null
// after
InputStream is = getClass().getResourceAsStream("/processes/proc.bpmn");
if (is == null) throw new IllegalArgumentException("processes/proc.bpmn missing on classpath");
repo.createDeployment().addClasspathResource("processes/proc.bpmn").deploy(); Defensive patterns
Strategy: validation
Validate before calling
InputStream is = getClass().getResourceAsStream(resourcePath);
if (is == null) {
throw new IllegalArgumentException("resource not on classpath: " + resourcePath);
}
repositoryService.createDeployment().addInputStream(resourceName, is); Type guard
boolean resourceExists(String p) { return getClass().getResource(p) != null; } Try / catch
try {
deploymentBuilder.addInputStream(name, is).deploy();
} catch (ActivitiIllegalArgumentException e) {
// stream was null — fix resource resolution
} Prevention
- Prefer addClasspathResource over manual streams
- Check ClassLoader.getResourceAsStream results for null
- Verify resources are packaged into the deployment artifact
When it happens
Trigger: repositoryService.createDeployment().addInputStream(name, stream) called with a null stream — e.g. getResourceAsStream returned null because the classpath resource is missing, or a failed file/network stream lookup returned null.
Common situations: Typo in classpath resource path so ClassLoader.getResourceAsStream returns null; loading a BPMN file from a location that doesn't exist in the packaged JAR; refactoring resource directories without updating deployment code.
Related errors
- Deployment id is null
- Deployment id is null
- deploymentId is null
- deploymentId is null
- deploymentId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c5889e19ce2d10bd.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentBuilderImpl.java:56
public class DeploymentBuilderImpl implements DeploymentBuilder, Serializable {
private static final long serialVersionUID = 1L;
protected transient RepositoryServiceImpl repositoryService;
protected DeploymentEntity deployment = new DeploymentEntity();
protected boolean isBpmn20XsdValidationEnabled = true;
protected boolean isProcessValidationEnabled = true;
protected boolean isDuplicateFilterEnabled;
protected Date processDefinitionsActivationDate;
public DeploymentBuilderImpl(RepositoryServiceImpl repositoryService) {
this.repositoryService = repositoryService;
}
@Override
public DeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
if (inputStream == null) {
throw new ActivitiIllegalArgumentException("inputStream for resource '" + resourceName + "' is null");
}
byte[] bytes = IoUtil.readInputStream(inputStream, resourceName);
ResourceEntity resource = new ResourceEntity();
resource.setName(resourceName);
resource.setBytes(bytes);
deployment.addResource(resource);
return this;
}
@Override
public DeploymentBuilder addClasspathResource(String resource) {
InputStream inputStream = ReflectUtil.getResourceAsStream(resource);
if (inputStream == null) {
throw new ActivitiIllegalArgumentException("resource '" + resource + "' not found");
}
return addInputStream(resource, inputStream);
}
View on GitHub (pinned to d6d39ce1c6)