cancel
Showing results for 
Search instead for 
Did you mean: 

Error closing a Process

f_lombardo
Champ in-the-making
Champ in-the-making
Hi all.

I'm using Actviti 5.11 via the REST API. Sometimes, when I close a task that triggers the end of a process, I get this error:

3-apr-2013 15.42.31 org.activiti.engine.impl.interceptor.CommandContext close
GRAVE: Error while closing command context
org.activiti.engine.ActivitiException: execution 35910 doesn't exist
   at org.activiti.engine.impl.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:52)
   at org.activiti.engine.impl.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:29)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:60)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariables(RuntimeServiceImpl.java:99)
   at org.activiti.rest.api.process.ProcessInstanceResource.addVariableList(ProcessInstanceResource.java:188)
   at org.activiti.rest.api.process.ProcessInstanceResource.getProcessInstance(ProcessInstanceResource.java:80)
   at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.restlet.resource.ServerResource.doHandle(ServerResource.java:452)
   at org.restlet.resource.ServerResource.get(ServerResource.java:648)
   at org.restlet.resource.ServerResource.doHandle(ServerResource.java:530)
   at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:590)
   at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:302)
   at org.restlet.resource.ServerResource.handle(ServerResource.java:849)
   at org.restlet.resource.Finder.handle(Finder.java:513)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Router.doHandle(Router.java:500)
   at org.restlet.routing.Router.handle(Router.java:740)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
   at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
   at org.restlet.Application.handle(Application.java:391)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Router.doHandle(Router.java:500)
   at org.restlet.routing.Router.handle(Router.java:740)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.routing.Router.doHandle(Router.java:500)
   at org.restlet.routing.Router.handle(Router.java:740)
   at org.restlet.routing.Filter.doHandle(Filter.java:159)
   at org.restlet.routing.Filter.handle(Filter.java:206)
   at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
   at org.restlet.Component.handle(Component.java:391)
   at org.restlet.Server.handle(Server.java:491)
   at org.restlet.engine.ServerHelper.handle(ServerHelper.java:74)
   at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:153)
   at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1031)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
3-apr-2013 15.42.31 org.restlet.engine.log.LogFilter afterHandle
INFO: 2013-04-03   15:42:31   192.168.x.y    PIPPO    192.168.x.y   8099   GET   /activiti-rest/service/process-instance/35910   -   200   -   0   31   http://192.168.x.y:8099   Restlet-Framework/2.0.14   -

Any hint?

Thanks in advance.

Bye

Franco
16 REPLIES 16

trademak
Star Contributor
Star Contributor
Hi,

Can you explain this a bit more?
I understand that you complete a task that ends the process instance.
But in the stacktrace I see that you are retrieving the process instance details of that ended process instance.
And that process instance doesn't exist anymore, so you'll get an exception.

Best regards,

f_lombardo
Champ in-the-making
Champ in-the-making
Hi,
I understand that you complete a task that ends the process instance.
But in the stacktrace I see that you are retrieving the process instance details of that ended process instance.
And that process instance doesn't exist anymore, so you'll get an exception.

That's true, but I think that Activiti should not throw any exception. As a matter of fact, if I call this REST API after a while, it responds the right way, telling me that the process exists, but it is completed:


{
    "processInstanceId": "35910",
    "businessKey": null,
    "processDefinitionId": "valutazioneParallelaRichiestaOfferta:10:29604",
    "startTime": "2013-04-02T09:21:22CEST",
    "startActivityId": "avvioProcesso",
    "startUserId": "PIPPO",
    "completed": true,
……

I think that there is a problem that arises when you close a process and, during the closing phase, you invoke the "process-instance" API.

Thanks.

Bye

Franco

jbarrez
Star Contributor
Star Contributor
Yes, but that is a matter of transactions: the second transaction doesn't see anything that hasn't been committed yet.

So I don't see how that could be solved without breaking a lot of other stuff.

f_lombardo
Champ in-the-making
Champ in-the-making
Uhm, is it a problem of timing? I mean, I sent the second command _after_ the first has been completed. For my program the commitment is completed.

Thanks

Bye

Franco

jbarrez
Star Contributor
Star Contributor
So you have 2 separate REST calls? The rest call will only return once the transaction is completed, so indeed the second one should see it.

Are you using async steps in your process? That could explain it.

f_lombardo
Champ in-the-making
Champ in-the-making
Yes, I have two separate REST calls.
Sorry, but I didn't understand what do you mean with "async steps".

Thank you very much.

Bye

Franco

jbarrez
Star Contributor
Star Contributor
I mean, what does your process do?

If you have two rest calls, I find it very hard to see why it would give different results depending on the timing … UNLESS the process using an asynchronous step, which means the first rest call would return before the process is actually done.

f_lombardo
Champ in-the-making
Champ in-the-making
Here you can see the image of my process:

http://www.francolombardo.net/wp-content/uploads/x.png

Each of the user tasks I defined is ended by a RAST call. They lead to task "Scelta percorsi" (the red A), which executes this code:

<java>
public class SceltaPercorsi implements ActivityBehavior {

  public void execute(ActivityExecution execution) throws Exception {
    List<PvmTransition> paths= calculateTheRightPaths();
   
    execution.inactivate();
   
    execution.takeAll(paths, new ArrayList<ActivityExecution>());
  }

}
</java>

Under some circumnstances my code finds that the only possible path is toward task "Mail avviso commmerciale" (the red B).

Is this an "asynchronous step"?

Thanks.

Bye

Franco

trademak
Star Contributor
Star Contributor
Ehmm, are you implementing your own parallel execution implementation? Why are you calling the inactivate method?
What's the code behind the calculateTheRightPaths method call?

Best regards,