cancel
Showing results for 
Search instead for 
Did you mean: 

useing taskService.complete(task.getId()) Occur exception?

sunxinzi
Champ in-the-making
Champ in-the-making
when useing   taskService.complete(task.getId()) Occur exception?  request help me,thanks!

detail informatiion:
activiti.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration"> 
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti?autoReconnect=true" />
    <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
    <property name="jdbcUsername" value="root" />
    <property name="jdbcPassword" value="root" />
    <property name="databaseType" value="mysql"></property>   
    <!– Database configurations –>
    <property name="databaseSchemaUpdate" value="false" />   
    <!– job executor configurations –>
    <property name="jobExecutorActivate" value="false" />
   
    <!– mail server configurations
    <property name="mailServerPort" value="5025" />  –>  
  </bean>

</beans>

code:
//完成任务
   public String completeapply() throws Exception{
      
      TaskService    taskService = this.processEngine.getTaskService();
      
      taskService.complete(this.taskId);
      
      
      return SUCCESS;
   }
exception detail information:
严重: Error while closing command context
org.activiti.engine.ActivitiException: Cannot find task with id 5435
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:45)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:27)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:138)
   at com.test.action.PrecessDefAction.completeapply(PrecessDefAction.java:104)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
3 REPLIES 3

larryeden_17
Champ in-the-making
Champ in-the-making
Please check taskId. It should not be null.

sunxinzi
Champ in-the-making
Champ in-the-making
the number  of  '5435' is taskid,it's not null already!

frederikherema1
Star Contributor
Star Contributor
How does your process look like (BPMN)?