Activiti/Activiti · error · ActivitiIllegalArgumentException
deploymentId is null
Error message
deploymentId is null
What it means
GetDeploymentResourceCmd.execute() validates its inputs before querying the resource entity manager. The deploymentId is required to look up a deployed resource, so a null id cannot be resolved and the command throws ActivitiIllegalArgumentException immediately. This is a fail-fast guard: no database lookup is attempted.
Solutions
- Ensure the deploymentId passed to getResourceAsStream(deploymentId, resourceName) is a non-null string obtained from a successful deployment (deployment.getId()).
- Check the calling code for a variable that is null because an earlier deployment/query call returned null, and handle that null before invoking the command.
- If the id comes from configuration, validate it at startup with a clear failure message instead of passing null downstream.
Example fix
// before
InputStream is = repositoryService.getResourceAsStream(deploymentId, "diagram.png");
// after
if (deploymentId == null) {
throw new IllegalStateException("deploymentId not set; was the deployment created?");
}
InputStream is = repositoryService.getResourceAsStream(deploymentId, "diagram.png"); Defensive patterns
Strategy: validation
Validate before calling
if (deploymentId == null || deploymentId.isEmpty()) {
throw new IllegalArgumentException("deploymentId required before getResourceAsStream");
} Try / catch
try {
InputStream is = repositoryService.getResourceAsStream(deploymentId, name);
} catch (ActivitiIllegalArgumentException e) {
// deploymentId was null; recover by re-resolving the deployment
} Prevention
- Always source deployment ids from the Deployment object returned by deploy().
- Assert non-null inputs at service boundaries before calling repository APIs.
- Fail fast at configuration load time if a deployment id property is blank.
When it happens
Trigger: Calling RepositoryService.getDeploymentResourceNames(null)... actually the resource variant: repositoryService.getResourceAsStream(null, "resourceName") or new GetDeploymentResourceCmd(null, name) executed via the command executor, passing a null deploymentId.
Common situations: A deployment id variable that was never assigned (e.g. a method returned null because deployment creation was skipped or failed), a config property like process.deployment.id left unset, or mapping a nullable entity field straight into the API call.
Related errors
- deploymentId is null
- resourceName is null
- Candidate group is null
- Candidate user is null
- category is null
AI-assisted analysis of Activiti/Activiti@56435b1a97 (2026-09-09).
Data as JSON: /api/errors/79500880add82f73.
Report an issue: GitHub.
Appendix: source
Thrown at activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/GetDeploymentResourceCmd.java:44
import org.activiti.engine.repository.Deployment;
/**
*/
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;
}
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().findById(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.classView on GitHub (pinned to 56435b1a97)