can not start process instance without any exceptions

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2013 11:05 PM
Hi~I have a bean that use for starting my process instance with the process variable, I use activiti 5.12 and activiti-cdi.
the code is quite sample:
public void startProcess(PurchaseOrder po) {
System.out.println("————-Process begin————");
businessProcess.setVariable("po", po);
System.out.println("————-set process variables done————");
businessProcess.startProcessByKey("myProcess");
System.out.println("————-Process started————");
}
the system out msg use for my debug.
everything is perfect using the following bpmn:
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<userTask id="usertask1" name="User Task"></userTask>
<sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="usertask2"></sequenceFlow>
<userTask id="usertask2" name="User Task"></userTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="usertask2" targetRef="endevent1"></sequenceFlow>
</process>
but when i change the "usertask1" to a email task, the process instance was not deployed. the system out msg remain in —set process variables done—– but not —-Process started—— and also , there is no exceptions.
the email task is also not special : <serviceTask id="mailtask1" name="Send email if received" activiti:type="mail">
I go on debug.
I set the email task as Asynchronous, the process instance will work, but seems the mail did not sent out successfully
and if I change the email task to a service task, it is no problem.
my engine configuration:
public ProcessEngine getProcessEngine() {
CdiJtaProcessEngineConfiguration processEngineConfiguration = new CdiJtaProcessEngineConfiguration();
processEngineConfiguration.setProcessEngineName("default");
processEngineConfiguration
.setDataSourceJndiName("java:jboss/datasources/MysqlDS");
processEngineConfiguration
.setTransactionManager(lookupTransactionManager());
processEngineConfiguration.setDatabaseType("mysql");
processEngineConfiguration.setDatabaseSchemaUpdate("true");
processEngineConfiguration.setTransactionsExternallyManaged(true);
processEngineConfiguration.setJobExecutorActivate(true);
processEngineConfiguration.setMailServerPort(1025);
processEngine = processEngineConfiguration.buildProcessEngine();
return processEngine;
}
Looking forward for the help~ Thank you.
the code is quite sample:
public void startProcess(PurchaseOrder po) {
System.out.println("————-Process begin————");
businessProcess.setVariable("po", po);
System.out.println("————-set process variables done————");
businessProcess.startProcessByKey("myProcess");
System.out.println("————-Process started————");
}
the system out msg use for my debug.
everything is perfect using the following bpmn:
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<userTask id="usertask1" name="User Task"></userTask>
<sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="usertask2"></sequenceFlow>
<userTask id="usertask2" name="User Task"></userTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="usertask2" targetRef="endevent1"></sequenceFlow>
</process>
but when i change the "usertask1" to a email task, the process instance was not deployed. the system out msg remain in —set process variables done—– but not —-Process started—— and also , there is no exceptions.
the email task is also not special : <serviceTask id="mailtask1" name="Send email if received" activiti:type="mail">
I go on debug.
I set the email task as Asynchronous, the process instance will work, but seems the mail did not sent out successfully
and if I change the email task to a service task, it is no problem.
my engine configuration:
public ProcessEngine getProcessEngine() {
CdiJtaProcessEngineConfiguration processEngineConfiguration = new CdiJtaProcessEngineConfiguration();
processEngineConfiguration.setProcessEngineName("default");
processEngineConfiguration
.setDataSourceJndiName("java:jboss/datasources/MysqlDS");
processEngineConfiguration
.setTransactionManager(lookupTransactionManager());
processEngineConfiguration.setDatabaseType("mysql");
processEngineConfiguration.setDatabaseSchemaUpdate("true");
processEngineConfiguration.setTransactionsExternallyManaged(true);
processEngineConfiguration.setJobExecutorActivate(true);
processEngineConfiguration.setMailServerPort(1025);
processEngine = processEngineConfiguration.buildProcessEngine();
return processEngine;
}
Looking forward for the help~ Thank you.
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2013 05:03 AM
Is the logging configured correcltly? maybe the error is swallowed. Have you tried debugging the java-code, up to the point where the process is actually started?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2013 05:41 AM
Thank you for the reply, the logging config should be no problem since the other activiti exceptions show out correctly. I have debug the java code, I set the break point at businessProcess.startProcessByKey("poManagementProcess"); and System.out.println("————-Process started————"); I press F5 all the way down, but it seems no problem for me.(I have no knowledge at Activiti source code
)
now my solution is create a service task and use java mail for my mail sending task. It works fine now.
BTW, the sample process is :
<java>
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="usertask1" name="User Task"></userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<userTask id="usertask2" name="User Task"></userTask>
<sequenceFlow id="flow2" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="usertask2" targetRef="endevent1"></sequenceFlow>
</process>
</java>
and the following process did not work:
<java>
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="mailtask1" name="Mail Task" activiti:type="mail"></serviceTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="mailtask1"></sequenceFlow>
<userTask id="usertask1" name="User Task"></userTask>
<sequenceFlow id="flow2" sourceRef="mailtask1" targetRef="usertask1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
</process>
</java>

now my solution is create a service task and use java mail for my mail sending task. It works fine now.
BTW, the sample process is :
<java>
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="usertask1" name="User Task"></userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<userTask id="usertask2" name="User Task"></userTask>
<sequenceFlow id="flow2" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="usertask2" targetRef="endevent1"></sequenceFlow>
</process>
</java>
and the following process did not work:
<java>
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="mailtask1" name="Mail Task" activiti:type="mail"></serviceTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="mailtask1"></sequenceFlow>
<userTask id="usertask1" name="User Task"></userTask>
<sequenceFlow id="flow2" sourceRef="mailtask1" targetRef="usertask1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
</process>
</java>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2013 11:45 AM
That's because the mail task doesn't contain any elements like to recipient, subject etc. So this can't work. Or did you not include all the details?
Best regards,
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2013 04:38 AM
I did contain the necessary elements of email task, actually the engine works well at another sample project using the same process.
The difference of current project is I call the startProcess method at a asynchronous method of a stateless bean, I use this bean to listen to the change of a folder, once there is new xml file come in, then start a new process. I dont know if it is the source of the problem.
The difference of current project is I call the startProcess method at a asynchronous method of a stateless bean, I use this bean to listen to the change of a folder, once there is new xml file come in, then start a new process. I dont know if it is the source of the problem.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2013 07:51 AM
That shouldn't be a problem.
Can you reproduce it in a unit test? That's the easiest and quickest way for us to verify and fix it.
Can you reproduce it in a unit test? That's the easiest and quickest way for us to verify and fix it.
