Process start ExecutionListener and exceptions
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 10:53 AM
Hey again,
I have a weird behaviour when in an ExecutionListener I have an exception raised by an Activiti Engine API.
Specifically, at start of a certain process I go looking into the deployment for the starting process if a certain file has been uploaded also, like this:
<blockcode>
RepositoryService repo = execution.getEngineServices().getRepositoryService();
ProcessDefinition pDef = repo.createProcessDefinitionQuery()
.processDefinitionId(execution.getProcessDefinitionId())
.singleResult();
InputStream is = repo.getResourceAsStream(pDef.getDeploymentId(), routingName);
// do something with is
</blockcode>
I mis-read the documentation and overlooked the ActivitObjectNotFoundException (I expected a simple null return value as Class.getResorceAsStream() does, no big deal).
Crazy thing is that if I catch and silence the exception, like this:
<blockcode>
try {
RepositoryService repo = execution.getEngineServices().getRepositoryService();
InputStream is = repo.getResourceAsStream(pDef.getDeploymentId(), resourceName);
// do something with is
} catch(ActivitObjectNotFoundException aonf) {
log.warn("exta resource not found, skipping")
}
</blockcode>
The task in the process will execute, but then I will have in the log an exception stack trace from the getResourceAsStream and all the transaction will be rolled back.
Why is that?
(Activiti 5.15.1)
I have a weird behaviour when in an ExecutionListener I have an exception raised by an Activiti Engine API.
Specifically, at start of a certain process I go looking into the deployment for the starting process if a certain file has been uploaded also, like this:
<blockcode>
RepositoryService repo = execution.getEngineServices().getRepositoryService();
ProcessDefinition pDef = repo.createProcessDefinitionQuery()
.processDefinitionId(execution.getProcessDefinitionId())
.singleResult();
InputStream is = repo.getResourceAsStream(pDef.getDeploymentId(), routingName);
// do something with is
</blockcode>
I mis-read the documentation and overlooked the ActivitObjectNotFoundException (I expected a simple null return value as Class.getResorceAsStream() does, no big deal).
Crazy thing is that if I catch and silence the exception, like this:
<blockcode>
try {
RepositoryService repo = execution.getEngineServices().getRepositoryService();
InputStream is = repo.getResourceAsStream(pDef.getDeploymentId(), resourceName);
// do something with is
} catch(ActivitObjectNotFoundException aonf) {
log.warn("exta resource not found, skipping")
}
</blockcode>
The task in the process will execute, but then I will have in the log an exception stack trace from the getResourceAsStream and all the transaction will be rolled back.
Why is that?
(Activiti 5.15.1)
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 06:14 AM
Is another Exception being thrown as well?
If you catch the exception then Activiti will not rollback the process instance.
Best regards,
If you catch the exception then Activiti will not rollback the process instance.
Best regards,
