cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti nested subprocess issues

ciarancorson1
Champ in-the-making
Champ in-the-making
Hi.

I'm working on something in work, and can't figure out where the issue resides - Activiti or in our RestTemplate calls. We're using 5.16.1
We're using activiti as a dependency in a service, where it handles various patterns like sub process nesting, and other complicated patterns. Lately we've been testing an approach to allow this nested subprocess pattern with sub processes being called by other sub processes. ie A calls B which calls C. As part of it we have some tests. One of them is where BPMN has 2 tasks.  BPMN "A" and BPMN "B" are deployed and present in the act_ge_bytearray tables. BPMN "C" is not deployed, and we expect an error to occur.

BPMN "A" has a task: CreateType. "A" then has a sub process, described in BPMN "B". 
"B" has a task: CreateType. "B" then has a task to call a subprocess in BPMN "C", which  is not currently deployed. This is expected. We want it to fail to test something.
The method findDeployedLatestProcessDefinitionByKeyAndTenantId() in DeploymentManager throws an ActivitiObjectNotFound exception.
"no processes deployed with key TestBPMNFail for tenant identifier CC".
I've noticed that the class executing this class (CommandContext, performOperation() ),  only has a try and finally. Where is the exception handled after this?


When I run this this test using our service, the complete task for B fails in CreateType, due to C not existing. It gives us a 404 Not Found back as the exception message.  We don't get back the error message raised from the DeploymentManager class. Should we? However, when I enable debug logging for org.activiti, we get the full message back in the activiti logs.  We're using RestTemplate to post from our service into activiti. We're using an errorHandler to deal with the http exception codes from activiti, the error codes return standarised messaged defined by activiti.


When I use curl to manually complete the command: "curl -POST 'http://localhostSmiley Tongueort/activiti/runtime/tasks/{taskId} -d '{"action" : "complete"}'" , I get the proper error message as shown above. 

What's the cause here? I was thinking that a complete task called by curl will call activiti directly. and a call made by our rest template is in a runtime engine so it's not aware of the exception, only the http request and response.
I'll be able to add more information tomorrow when I am back in work.


Thanks.


6 REPLIES 6

ciarancorson1
Champ in-the-making
Champ in-the-making
I'll be able to attach stack traces and bpmn's tomorrow. Also, does each subprocess get it's own engine, or do they all share one?

ciarancorson1
Champ in-the-making
Champ in-the-making
I've attached the logs that I've seen in activiti:

This is the complete task failure message we get:
Caused by: "OurOwnServiceException" Can't complete task 130029: 404 Not Found.
This is persisted back from activiti.

Basically, why does a direct manual curl command to Activiti return the proper error message, and our subprocess call to activiti does not?


ciarancorson1
Champ in-the-making
Champ in-the-making
Can anybody help me with this? I've spent a few days trying to debug this, but the issue remains the same. Activiti is not returning the exception from the subprocess, so further up the stack trace all I get is a 404, and not the error message that activiti has thrown.

jbarrez
Star Contributor
Star Contributor
"Basically, why does a direct manual curl command to Activiti return the proper error message, and our subprocess call to activiti does not?"

I' not sure I'm following the use case here, cause there is a lot going on here. But the error is clear:

org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'CC.FailSubprocess' for tenant identifier 'CC'

There is no process definition with the 'CC.FailSubprocess' id deployed for that particular tenant id.
How does your ACT_RE_PROCDEF look like?

I'm not sure about the subprocess vs curl call … if curl does it right, i would look into the direction of resttemplate.

ciarancorson1
Champ in-the-making
Champ in-the-making
Thanks for the reply.  The ActivitiObjectNotFoundException is expected, we're trying to add some validation to ensure any user that is creating sub processes does so correctly when deploying their BPMN.

I think it may be something to do with the RestTemplate, which I am investigating.
I have also created a python requests call, and I get the full error message back. I would think that is is a deserialization issue and will ask internally about it.

Thanks for the help.

ciarancorson1
Champ in-the-making
Champ in-the-making
I have figured it out. It was something to do with the rest error handler we've created for activiti .
I've overridden the handleError method(a  spring framework method) and thrown an exception with the response body.
This can be considered resolved.

Thanks.