[JBoss jBPM] - Error handling in CommandServiceBean.execute
by boercher
Hi,
a little bug in my test program in which I tried remote command execution took me quite a while to analyse. The problem was that instead of an error message indicating the real error I got this one:
anonymous wrote : ERROR [org.jboss.ejb.plugins.LogInterceptor] (WorkerThread#0[127.0.0.1:1264])
| RuntimeException in method: public abstract java.lang.Object
| org.jbpm.ejb.RemoteCommandService.execute(org.jbpm.command.Command)
| throws java.rmi.RemoteException:
| org.hibernate.exception.GenericJDBCException: Cannot open connection
| ...
| at org.jbpm.JbpmContext.close(JbpmContext.java:129)
| at org.jbpm.ejb.impl.CommandServiceBean.execute(CommandServiceBean.java:124)
The reason for the misleading error message was a missing try-catch block in CommandServiceBean.execute (in jbpm-3.2.6.SP1):
public Object execute(Command command) {
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| log.debug("executing " + command);
| return command.execute(jbpmContext);
| }
| catch (RuntimeException e) {
| sessionContext.setRollbackOnly();
| throw e;
| }
| catch (Exception e) {
| sessionContext.setRollbackOnly();
| throw new JbpmException("failed to execute " + command, e);
| }
| finally {
| jbpmContext.close();
| }
| }
|
The finally block performs some non-trivial cleanup-operations that easily may throw exceptions in case of a preceding error. Errors in command execution would be much easier to spot if the finally block would be coded like that:
finally {
| try {
| jbpmContext.close();
| }
| catch (Throwable t) {
| log.error("error on context close", t);
| }
| }
|
but development on 3.2 has been stopped, right?
Regards,
Volker
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222462#4222462
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222462
15 years, 8 months
[JBoss jBPM] - Re: How to reassign from group to actor using CommandService
by gfargone
Here is some code I was trying:
// Get context.
InitialContext ic = new InitialContext();
// Find the command service bean.
rcs = (RemoteCommandServiceHome) ic.lookup("ejb/CommandServiceBean");
// Create a new process instance.
StartProcessInstanceCommand newProcessInstance = new StartProcessInstanceCommand();
newProcessInstance.setProcessName("CreateDevice");
newProcessInstance.setStartTransitionName("start");
newProcessInstance.setActorId("ffvnqb");
// Set process variables.
newProcessInstance.setVariables(varMap);
ProcessInstance procInst = (ProcessInstance) rcs.create().execute(newProcessInstance);
Long processId = procInst.getId();
System.out.println("Process Id: " + processId);
long taskInstanceId = 0;
// Get task list. Include task variables.
GetTaskListCommand taskListCommand = new GetTaskListCommand("admin",true);
List taskInstanceList = (List) rcs.create().execute(taskListCommand);
for (TaskInstance task : taskInstanceList) {
System.out.println("Task Name: " + task.getName());
System.out.println("Task Instance Id: " + task.getId());
System.out.println("Original Task Assignment: " + task.getActorId());
taskInstanceId = task.getId();
}
//
StartWorkOnTaskCommand startTaskCommand = new StartWorkOnTaskCommand(taskInstanceId, true);
rcs.create().execute(startTaskCommand);
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222433#4222433
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222433
15 years, 8 months
[JBoss jBPM] - Problem with Roles JBPM
by konstt2000
Hi,
I've two users: - Admin1 with role "ADMIN" and actorid "Admin1" and Admin2 with role "ADMIN" and actorid "Admin2"
I've the next definition process:
<start-state name="start">
| <transition to="estado1"></transition>
| </start-state>
|
| <task-node name="estado1">
| <task name="estado1" description="estado1">
| <assignment pooled-actors="ADMIN"/>
| </task>
| <transition to="estado2" />
| </task-node>
| <end-state name="done"/>
When I call to @CreateProcess it appears in the pooledTaskInstanceList of both users. But when it is called to @StartTask the ACTORID it is fixed and only it appears in the list taskInstanceList of the user who has begun the task.
If both users belong to the same role, there is no way of which they could see that each of the users are executing tasks?
Thanks and sorry for my english.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222364#4222364
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222364
15 years, 8 months