AnsweredAssumed Answered

Complete task with sequenceFlow condition

Question asked by aurelienpel on Dec 4, 2014
Latest reply on Dec 5, 2014 by martin.grofcik
Hi,

I have a problem when completing a task which has a sequenceFlow condition.
If you have a look at the attached process, the first task has no condition to pass through the gateway, so there's no problem when completing this one. But when I want to complete the task 'team2' to go to 'team3' or 'team4' to go to 'team5' , I get an error that I don't understand.

Here is my code to complete a task :

public String completeTaskJavaAPI(
         @QueryParam("taskId") String taskId,
         @QueryParam("buttonValue") String buttonValue)
         throws Exception{
      
      LOGGER.info("—> beginning completing the task");
      String response = "task can't be completed";
      try{   
         
         Map<String, Object> taskVariables = new HashMap<String, Object>();
         taskVariables.put("buttonValue", buttonValue);
         LOGGER.info("taskVariables : {}", taskVariables);
         
         ProcessEngines
               .getDefaultProcessEngine()
               .getTaskService()
               .complete(taskId, taskVariables);
         
         response = "task completed";
      }catch(Exception e){
         LOGGER.error("Error completing task : {}", taskId, e);
      }
      return response;
   }


Here are the logs :


[INFO] 2014-12-04 10:05:34,797 TasksResource —> beginning completing the task
[INFO] 2014-12-04 10:05:34,798 TasksResource taskVariables : {buttonValue=team3}
127.0.0.1 -  -  [04/déc./2014:10:05:34 +0100] "GET /TasksJavaAPI/completeTaskJavaAPI?taskId=670006&buttonValue=team3 HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36" 113
[ERROR] 2014-12-04 10:05:34,906 TasksResource Error claiming task 670006
org.activiti.engine.ActivitiException: Unknown property used in expression: ${team2=="team3"}
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53)
   at org.activiti.engine.impl.el.UelExpressionCondition.evaluate(UelExpressionCondition.java:37)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:123)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:64)
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.signal(UserTaskActivityBehavior.java:139)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:397)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:200)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:50)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
   at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:59)
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:179)
   at resources.engine.tasks.TasksResource.completeTaskJavaAPI(TasksResource.java:347)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
   at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
   at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
   at com.codahale.metrics.jersey.InstrumentedResourceMethodDispatchProvider$TimedRequestDispatcher.dispatch(InstrumentedResourceMethodDispatchProvider.java:30)
   at io.dropwizard.jersey.guava.OptionalResourceMethodDispatchAdapter$OptionalRequestDispatcher.dispatch(OptionalResourceMethodDispatchAdapter.java:37)
   at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
   at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
   at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
   at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
   at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
   at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
   at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
   at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
   at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
   at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
   at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
   at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
   at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1515)
   at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
   at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:348)
   at io.dropwizard.jetty.BiDiGzipFilter.doFilter(BiDiGzipFilter.java:127)
   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1486)
   at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:29)
   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1486)
   at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:44)
   at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:39)
   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1486)
   at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:248)
   at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:211)
   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1486)
   at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:519)
   at org.eclipse.jetty.server.handler.ContextHandler.__doHandle(ContextHandler.java:1097)
   at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java)
   at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:448)
   at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1031)
   at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
   at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:175)
   at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
   at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:92)
   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
   at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:162)
   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
   at org.eclipse.jetty.server.Server.handle(Server.java:446)
   at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:271)
   at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:246)
   at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
   at java.lang.Thread.run(Unknown Source)
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'team2'
   at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
   at org.activiti.engine.impl.juel.AstBinary$SimpleOperator.eval(AstBinary.java:27)
   at org.activiti.engine.impl.juel.AstBinary.eval(AstBinary.java:106)
   at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
   at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
   at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
   at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:48)
   … 75 common frames omitted


I don't understand why when I have a sequenceFlow condition to a task, it retrieves an error with : 'Unknown property used in expression: ${team2=="team3"}'

Later in my instance, when I am at the task just before the exclusive gateway, I have the same result, so I guess it is linked to the sequenceFlow condition, because at the beginning, there's no condition and it is ok.

Did I forget something in my completeTask method ?

Thanks for your help !

Best regards,

Aurelien

Outcomes