cancel
Showing results for 
Search instead for 
Did you mean: 

Can not Assign task using task.setAssignee() !!

mahmoudnawwar
Champ in-the-making
Champ in-the-making
I'm beginner , I Succeeded to run Activiti Explorer With Mysql Database but When I create Task In Management Group and Try to Assign It to user I Failed !!
this is my code
ProcessEngine processEngine = ProcessEngineConfiguration
            .createStandaloneProcessEngineConfiguration()
            .setJdbcUrl(
                  "jdbc:mysql://192.168.1.7:3306/activiti2?autoReconnect=true")
            .setJdbcDriver("com.mysql.jdbc.Driver").setJdbcUsername("root")
            .setJdbcPassword("root").setDatabaseSchemaUpdate("true")
            .buildProcessEngine();

TaskService taskService = processEngine.getTaskService();

Task task = taskService.createTaskQuery().taskCandidateGroup("management").singleResult();
task.setOwner("kermit");
task.setAssignee("fozzie");
taskService.saveTask(task);

I found his error
Exception in thread "main" org.activiti.engine.ActivitiIllegalArgumentException: unknown type 'user' approver
   at org.activiti.engine.impl.form.FormTypes.parseFormPropertyType(FormTypes.java:55)
   at org.activiti.engine.impl.form.DefaultFormHandler.parseConfiguration(DefaultFormHandler.java:61)
   at org.activiti.engine.impl.form.DefaultStartFormHandler.parseConfiguration(DefaultStartFormHandler.java:34)
   at org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler.createStartFormHandlers(StartEventParseHandler.java:84)
   at org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler.executeParse(StartEventParseHandler.java:58)
   at org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler.executeParse(StartEventParseHandler.java:38)
   at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:84)
   at org.activiti.engine.impl.bpmn.parser.handler.AbstractFlowNodeBpmnParseHandler.parse(AbstractFlowNodeBpmnParseHandler.java:27)
   at org.activiti.engine.impl.bpmn.parser.handler.AbstractActivityBpmnParseHandler.parse(AbstractActivityBpmnParseHandler.java:36)
   at org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers.parseElement(BpmnParseHandlers.java:73)
   at org.activiti.engine.impl.bpmn.parser.BpmnParse.processFlowElements(BpmnParse.java:435)
   at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.transformProcess(ProcessParseHandler.java:88)
   at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.executeParse(ProcessParseHandler.java:49)
   at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.executeParse(ProcessParseHandler.java:35)
   at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:84)
   at org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers.parseElement(BpmnParseHandlers.java:73)
   at org.activiti.engine.impl.bpmn.parser.BpmnParse.transformProcessDefinitions(BpmnParse.java:395)
   at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:231)
   at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:107)
   at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:50)
   at org.activiti.engine.impl.persistence.deploy.DeploymentManager.resolveProcessDefinition(DeploymentManager.java:115)
   at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedProcessDefinitionById(DeploymentManager.java:65)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.getTaskDefinition(TaskEntity.java:751)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:711)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.setAssignee(TaskEntity.java:561)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.update(TaskEntity.java:143)
   at org.activiti.engine.impl.cmd.SaveTaskCmd.execute(SaveTaskCmd.java:44)
   at org.activiti.engine.impl.cmd.SaveTaskCmd.execute(SaveTaskCmd.java:26)
   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:37)
   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.saveTask(TaskServiceImpl.java:84)
   at com.activiti.book.AssigneTask.main(AssigneTask.java:89)

3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

the problem is:

Exception in thread "main" org.activiti.engine.ActivitiIllegalArgumentException: unknown type 'user' approver
Your process engine configuration

ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()

differs from process engine configuration used by activiti explorer. Process definition (form type) refers to the undefined type (it is not configured in the process engine configuration)

  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
   <property name="dataSource" ref="dataSource" />
   <property name="transactionManager" ref="transactionManager" />
   <property name="databaseSchemaUpdate" value="true" />
   <property name="jobExecutorActivate" value="true" />
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
        <bean class="org.activiti.explorer.form.MonthFormType"/>  
      </list>
    </property>
  </bean>

Regards
Martin

mahmoudnawwar
Champ in-the-making
Champ in-the-making
Thanks For your Quick Reply !

Could you Show Me The Right Method to Create ProcessEngine, Please?

I tried

<java> ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine() </java>

but it throws null pointer Exception !!

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Mahmoud,

Your jUnit test can extend org.activiti.engine.impl.test.ResourceActivitiTestCase. In the constructor you can point to the resource (your own activiti context -> activiti-standalone-context.xml) to configure the engine.

Regards
Martin