[jBPM] - When do Sub Task Strategy executed?
by Thomas Setiabudi
Thomas Setiabudi [https://community.jboss.org/people/thomas.setiabudi] created the discussion
"When do Sub Task Strategy executed?"
To view the discussion, visit: https://community.jboss.org/message/795110#795110
--------------------------------------------------------------
Hi,
We use JBPM 5.4.
We can set sub task strategy to a task, but we have some questions:
1. When do actually the code inside the execute(..) method of a Sub Task Strategy is called?
2. Where should we put the sub task strategy such as OnParentAbortAllSubTasksEndStrategy or OnAllSubTasksEndParentEndStrategy? on the parent task? on the sub task? both?
3. If we look at the implementation of org.jbpm.task.OnParentAbortAllSubTasksEndStrategy
public void execute(TaskServiceSession taskServiceSession, TaskService service, Task task) {
List<TaskSummary> subTasks = taskServiceSession.getSubTasksByParent(task.getId(), "en-UK");
for(TaskSummary taskSummary : subTasks){
Task subTask = taskServiceSession.getTask(taskSummary.getId());
service.addEventListener(new InternalTaskEventListener(taskServiceSession));
service.getEventSupport().fireTaskCompleted( subTask.getId(),
subTask.getTaskData().getActualOwner().getId(),
subTask.getTaskData().getProcessSessionId());
}
}
when do this code: service.getEventSupport().fireTaskCompleted( ..)
is executed?
Which part of it says that this will be executed when the parent task is aborted?
Any help is appreciated.
Regards,
Thomas Setiabudi
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/795110#795110]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 10 months
[jBPM] - JTA Problem with multiple sessions
by Gareth Edwards
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion
"JTA Problem with multiple sessions"
To view the discussion, visit: https://community.jboss.org/message/795428#795428
--------------------------------------------------------------
Hello.
I am writing a system which will allow my to start instances of work-flows using a rest api as well as managing all the human tasks.
For now I am using one instance of a KnowlegeBase which uses an EntityManagerFactory like this:
if (emf == null){
emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
}
I am using a Stateful knowledge session per work-flow instance.
JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
String connectorName = "Hornet" + UUID.randomUUID().toString();
AsyncHornetQHTWorkItemHandler workItemHandler = new AsyncHornetQHTWorkItemHandler(new AsyncHornetQTaskClient(connectorName), ksession, OnErrorAction.LOG);
workItemHandler.setIpAddress("192.168.1.90");
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
ksession.startProcess(workflowSession.getWorkflowName(),workflowSession.getWorkFlowData());
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
With a clean postgres database the first completion of the human task (and end of the work-flow) I get no problems:
15:12:54,302 INFO [stdout] (workflowExecutor-1) Workflow Instance Variables
15:12:54,303 INFO [stdout] (workflowExecutor-1) agent:krisv
15:12:54,305 INFO [stdout] (workflowExecutor-1) test_id:TZ001A0001
15:13:56,128 INFO [stdout] (Thread-76) test_id is correct
15:13:56,128 INFO [stdout] (Thread-76) test_id:TZ001A0001
15:13:56,128 INFO [stdout] (Thread-76) submitted_test_id:TZ001A0001
But then running the work-flow again (new session) I almost always get problems:
15:14:33,869 INFO [stdout] (workflowExecutor-2) Workflow Instance Variables
15:14:33,870 INFO [stdout] (workflowExecutor-2) agent:krisv
15:14:33,870 INFO [stdout] (workflowExecutor-2) test_id:TZ001A0001
15:14:54,675 INFO [stdout] (Thread-76) test_id is correct
15:14:54,675 INFO [stdout] (Thread-76) test_id:TZ001A0001
15:14:54,675 INFO [stdout] (Thread-76) submitted_test_id:TZ001A0001
15:14:54,692 INFO [stdout] (Thread-77) test_id is correct
15:14:54,692 INFO [stdout] (Thread-77) test_id:TZ001A0001
15:14:54,693 INFO [stdout] (Thread-77) submitted_test_id:TZ001A0001
15:14:54,719 WARN [com.arjuna.ats.arjuna] (Thread-77) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff7f000101:-62cc4985:510a8991:60, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@339ec220 >: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#11]
at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1394) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1308) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1481) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:179) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$GetResultContentResponseHandler.execute(AsyncGenericHTWorkItemHandler.java:302) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#11]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2359) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3127) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3327) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:91) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:191) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 17 more
15:14:54,732 WARN [org.drools.persistence.jta.JtaTransactionManager] (Thread-77) Unable to commit transaction: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:179) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$GetResultContentResponseHandler.execute(AsyncGenericHTWorkItemHandler.java:302) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]
Caused by: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#11]
at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1394) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1308) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1481) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
... 11 more
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#11]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2359) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3127) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3327) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:91) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:191) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 17 more
15:14:54,737 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-77) Could not commit session: java.lang.RuntimeException: Unable to commit transaction
at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:182) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:376) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$GetResultContentResponseHandler.execute(AsyncGenericHTWorkItemHandler.java:302) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:167)
at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:179) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
... 7 more
Caused by: javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#11]
at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1394) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1308) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1481) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
... 11 more
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.persistence.processinstance.ProcessInstanceInfo#11]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2359) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3127) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3327) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:91) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:191) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 17 more
15:14:54,748 WARN [org.drools.persistence.jta.JtaTransactionManager] (Thread-77) Unable to rollback transaction: java.lang.IllegalStateException: BaseTransaction.rollback - ARJUNA016074: no transaction!
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:130)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:114)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:175)
at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:191) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$GetResultContentResponseHandler.execute(AsyncGenericHTWorkItemHandler.java:302) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]
15:14:54,751 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-77) Could not rollback: java.lang.RuntimeException: Unable to rollback transaction
at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:197) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$GetResultContentResponseHandler.execute(AsyncGenericHTWorkItemHandler.java:302) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]
Caused by: java.lang.IllegalStateException: BaseTransaction.rollback - ARJUNA016074: no transaction!
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:130)
|
| at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:114) |
|
| at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:175) |
|
| at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:191) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] |
|
| ... 8 more |
15:14:54,754 ERROR [org.jbpm.task.service.hornetq.HornetQTaskClientConnector] (Thread-77) Client Exception with class class org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1 using port 5153: java.lang.RuntimeException: Could not commit session or rollback
|
| at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:406) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] |
|
| at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:381) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] |
|
| at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final] |
|
| at org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$GetResultContentResponseHandler.execute(AsyncGenericHTWorkItemHandler.java:302) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] |
|
| at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] |
|
| at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final] |
|
| at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122) [jbpm-human-task-hornetq-5.4.0.Final.jar:5.4.0.Final] |
|
| at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18] |
Caused by: java.lang.RuntimeException: Unable to rollback transaction
|
| at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:197) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] |
|
| at org.drools.persistence.SingleSessionCommandService.rollbackTransaction(SingleSessionCommandService.java:402) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] |
|
| ... 7 more |
Caused by: java.lang.IllegalStateException: BaseTransaction.rollback - ARJUNA016074: no transaction!
|
| at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:130) |
|
| at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:114) |
|
| at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:175) |
|
| at org.drools.persistence.jta.JtaTransactionManager.rollback(JtaTransactionManager.java:191) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] |
|
| ... 8 more |
I'm using the bundled human-task-war.war application to handle human tasks.
The persistence for my EntityManagerFactory is configured using the following persistence.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="2.0"
xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="org.jbpm.persistence.jpa"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
<mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file>
<mapping-file>META-INF/ProcessInstanceInfoMapping-JPA2.xml</mapping-file>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<class>org.jbpm.process.audit.VariableInstanceLog</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.max_fetch_depth" value="3" />
<!-- property name="hibernate.hbm2ddl.auto" value="update" /-->
<property name="hibernate.show_sql" value="false" />
<!--property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" /-->
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem
to cause problems -->
<property name="hibernate.id.new_generator_mappings" value="false" />
</properties>
</persistence-unit>
</persistence>
I tried the change below as it was suggested by another user with similar problems with Postgres
<!--property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" /-->
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
But that didn't seem to help.
I hope somebody can help
Thanks in advance,
Gareth.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/795428#795428]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 10 months
[jBPM] - Facing an error while using service task for web service
by snowstorm tech
snowstorm tech [https://community.jboss.org/people/snowstormuser] created the discussion
"Facing an error while using service task for web service"
To view the discussion, visit: https://community.jboss.org/message/795331#795331
--------------------------------------------------------------
Hi,
I am facing an error while execuation of the example from this link.
> https://github.com/mswiderski/jbpm-examples/blob/master/jbpm-ws-sample/ https://github.com/mswiderski/jbpm-examples/blob/master/jbpm-ws-sample/
here i'm provding the *bpmn file*, *java code* and *error*
The web service that i used is:-*
*
> http://schemas.xmlsoap.org/wsdl/" location="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" namespace="http://ws.cdyne.com/WeatherWS/
And i also used the class which are genrated for the webservice above specified in my project class path.
*bpmn file:-*
*
*
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions id="Definition"
> targetNamespace=" http://www.example.org/MinimalExample http://www.example.org/MinimalExample"
> typeLanguage=" http://www.java.com/javaTypes http://www.java.com/javaTypes"
> expressionLanguage=" http://www.mvel.org/2.0 http://www.mvel.org/2.0"
> xmlns=" http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/20100524/MODEL"
> xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation=" http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
> xmlns:g=" http://www.jboss.org/drools/flow/gpd http://www.jboss.org/drools/flow/gpd"
> xmlns:bpmndi=" http://www.omg.org/spec/BPMN/20100524/DI http://www.omg.org/spec/BPMN/20100524/DI"
> xmlns:dc=" http://www.omg.org/spec/DD/20100524/DC http://www.omg.org/spec/DD/20100524/DC"
> xmlns:di=" http://www.omg.org/spec/DD/20100524/DI http://www.omg.org/spec/DD/20100524/DI"
> xmlns:tns=" http://www.jboss.org/drools http://www.jboss.org/drools">
>
> <import importType=" http://schemas.xmlsoap.org/wsdl/ http://schemas.xmlsoap.org/wsdl/" location=" http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" namespace=" http://ws.cdyne.com/WeatherWS/ http://ws.cdyne.com/WeatherWS/"/>
>
>
> <itemDefinition id="_sItem"/>
>
>
> <itemDefinition id="_listItem" structureRef="java.util.Collection"/>
>
> <itemDefinition id="_listItemOut" structureRef="java.util.Collection"/>
> <itemDefinition id="_map" structureRef="java.util.Map"/>
>
>
> <itemDefinition id="_2-2-4-itemItem" />
>
>
> <itemDefinition id="_5-listItem" />
>
>
> <itemDefinition id="_2_multiInstanceItemType" />
>
> <itemDefinition id="_2_multiInstanceItemOutType"/>
>
>
> <itemDefinition id="_2-2-4_InMessageType" />
> <message id="_2-2-4_InMessage" itemRef="_2-2-4_InMessageType" />
> <interface id="_2-2-4_ServiceInterface" name="" implementationRef="WeatherSoap">
> <operation id="_2-2-4_ServiceOperation" implementationRef="GetCityWeatherByZIP" name="">
> <inMessageRef>_2-2-4_InMessage</inMessageRef>
> </operation>
> </interface>
>
>
> <process processType="Private" isExecutable="true" id="WeatherWSServiceProcess" name="WeatherWSServiceProcess" tns:packageName="defaultPackage">
>
>
> <!-- process variables -->
> <property id="list" itemSubjectRef="_listItem"/>
> <property id="listOut" itemSubjectRef="_listItemOut"/>
> <property id="mode" itemSubjectRef="_sItem"/>
> <property id="map" itemSubjectRef="_map"/>
>
>
> <!-- nodes -->
> <startEvent id="_1" name="StartProcess" >
> </startEvent>
> <scriptTask id="_21" name="Prepare input" scriptFormat=" http://www.java.com/java http://www.java.com/java" >
> <script>
> System.out.println("Get zip code result is " + map);
> list = new java.util.ArrayList(map.values());
> list.remove("Complete");
> listOut = new java.util.ArrayList();
> kcontext.setVariable("list", list);
> kcontext.setVariable("listOut", listOut);
> </script>
> </scriptTask>
> <serviceTask id="_2" name="Get weather forecast" operationRef="_2-2-4_ServiceOperation" implementation="##WebService" >
> <extensionElements>
> <tns:onEntry-script scriptFormat=" http://www.java.com/java http://www.java.com/java">
> <script>System.out.println("WS1");</script>
> </tns:onEntry-script>
> <tns:onExit-script>
> <script>System.out.println("WS2");</script>
> </tns:onExit-script>
> </extensionElements>
> <ioSpecification>
> <dataInput id="_2-2-4_param" name="Parameter" />
> <dataInput id="DataInput_1" name="mode"/>
>
> <dataInput id="_2_listInput" name="list"/>
> <dataOutput id="_2_listOutOutput" name="listOut"/>
> <dataOutput id="_2-2-4_result" name="Result" />
> <inputSet>
> <dataInputRefs>_2-2-4_param</dataInputRefs>
> <dataInputRefs>DataInput_1</dataInputRefs>
> </inputSet>
> <outputSet>
> <dataOutputRefs>_2_listOutOutput</dataOutputRefs>
> </outputSet>
> </ioSpecification>
> <dataInputAssociation>
> <targetRef>_2-2-4_param</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression">#{item}</from>
> <to xsi:type="tFormalExpression">_2-2-4_param</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <sourceRef>mode</sourceRef>
> <targetRef>DataInput_1</targetRef>
> </dataInputAssociation>
> <dataInputAssociation id="DataInputAssociation_1">
> <sourceRef>list</sourceRef>
> <targetRef>_2_listInput</targetRef>
> </dataInputAssociation>
> <dataOutputAssociation>
> <sourceRef>_2-2-4_result</sourceRef>
> <targetRef>itemOut</targetRef>
> </dataOutputAssociation>
> <multiInstanceLoopCharacteristics>
> <loopDataInputRef>_2_input</loopDataInputRef>
> <loopDataOutputRef>_2_listOutOutput</loopDataOutputRef>
> <inputDataItem id="item" itemSubjectRef="_2_multiInstanceItemType"/>
> <outputDataItem id="itemOut" itemSubjectRef="_2_multiInstanceItemOutType"/>
> </multiInstanceLoopCharacteristics>
> </serviceTask>
>
> <scriptTask id="_3" name="Log result" >
> <script>System.out.println("Service result " + listOut);</script>
> </scriptTask>
> <endEvent id="_4" name="EndProcess" >
> <terminateEventDefinition/>
> </endEvent>
> <userTask id="_5" name="Get zip codes" >
> <ioSpecification>
> <dataInput id="_2_CommentInput" name="Comment" />
> <dataInput id="_2_SkippableInput" name="Skippable" />
> <dataInput id="_2_TaskNameInput" name="TaskName" />
> <dataInput id="_2_GroupIdInput" name="GroupId" />
> <dataInput id="_2_PriorityInput" name="Priority" />
> <dataOutput id="_2_ResultOutput" name="Result" />
> <inputSet>
> <dataInputRefs>_2_CommentInput</dataInputRefs>
> <dataInputRefs>_2_SkippableInput</dataInputRefs>
> <dataInputRefs>_2_TaskNameInput</dataInputRefs>
> <dataInputRefs>_2_GroupIdInput</dataInputRefs>
> <dataInputRefs>_2_PriorityInput</dataInputRefs>
> </inputSet>
> <outputSet>
> <dataOutputRefs>_2_ResultOutput</dataOutputRefs>
> </outputSet>
> </ioSpecification>
> <dataInputAssociation>
> <targetRef>_2_CommentInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression"></from>
> <to xsi:type="tFormalExpression">_2_CommentInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_SkippableInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression">false</from>
> <to xsi:type="tFormalExpression">_2_SkippableInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_TaskNameInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression">firstTask</from>
> <to xsi:type="tFormalExpression">_2_TaskNameInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_GroupIdInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression"></from>
> <to xsi:type="tFormalExpression">_2_GroupIdInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_2_PriorityInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression"></from>
> <to xsi:type="tFormalExpression">_2_PriorityInput</to>
> </assignment>
> </dataInputAssociation>
> <dataOutputAssociation>
> <sourceRef>_2_ResultOutput</sourceRef>
> <targetRef>map</targetRef>
> </dataOutputAssociation>
> <potentialOwner>
> <resourceAssignmentExpression>
> <formalExpression>john</formalExpression>
> </resourceAssignmentExpression>
> </potentialOwner>
> </userTask>
>
> <userTask id="_6" name="Show forecast" >
> <ioSpecification>
> <dataInput id="_4_outputInput" name="output" />
> <dataInput id="_4_CommentInput" name="Comment" />
> <dataInput id="_4_SkippableInput" name="Skippable" />
> <dataInput id="_4_TaskNameInput" name="TaskName" />
> <dataInput id="_4_GroupIdInput" name="GroupId" />
> <dataInput id="_4_PriorityInput" name="Priority" />
> <inputSet>
> <dataInputRefs>_4_outputInput</dataInputRefs>
> <dataInputRefs>_4_CommentInput</dataInputRefs>
> <dataInputRefs>_4_SkippableInput</dataInputRefs>
> <dataInputRefs>_4_TaskNameInput</dataInputRefs>
> <dataInputRefs>_4_GroupIdInput</dataInputRefs>
> <dataInputRefs>_4_PriorityInput</dataInputRefs>
> </inputSet>
> <outputSet>
> </outputSet>
> </ioSpecification>
> <dataInputAssociation>
> <sourceRef>listOut</sourceRef>
> <targetRef>_4_outputInput</targetRef>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_4_CommentInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression"></from>
> <to xsi:type="tFormalExpression">_4_CommentInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_4_SkippableInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression">false</from>
> <to xsi:type="tFormalExpression">_4_SkippableInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_4_TaskNameInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression">secondTask</from>
> <to xsi:type="tFormalExpression">_4_TaskNameInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_4_GroupIdInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression"></from>
> <to xsi:type="tFormalExpression">_4_GroupIdInput</to>
> </assignment>
> </dataInputAssociation>
> <dataInputAssociation>
> <targetRef>_4_PriorityInput</targetRef>
> <assignment>
> <from xsi:type="tFormalExpression"></from>
> <to xsi:type="tFormalExpression">_4_PriorityInput</to>
> </assignment>
> </dataInputAssociation>
> <potentialOwner>
> <resourceAssignmentExpression>
> <formalExpression>john</formalExpression>
> </resourceAssignmentExpression>
> </potentialOwner>
> </userTask>
>
>
> <!-- connections -->
> <sequenceFlow id="_21-_2" sourceRef="_21" targetRef="_2" />
> <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
> <sequenceFlow id="_3-_6" sourceRef="_3" targetRef="_6" />
> <sequenceFlow id="_1-_5" sourceRef="_1" targetRef="_5" />
> <sequenceFlow id="_5-_21" sourceRef="_5" targetRef="_21" />
> <sequenceFlow id="_6-_4" sourceRef="_6" targetRef="_4" />
>
>
> </process>
>
>
> <bpmndi:BPMNDiagram>
> <bpmndi:BPMNPlane bpmnElement="WeatherWSServiceProcess" >
> <bpmndi:BPMNShape bpmnElement="_1" >
> <dc:Bounds x="16" y="67" width="48" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_2" >
> <dc:Bounds x="228" y="16" width="200" height="150" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_21" >
> <dc:Bounds x="128" y="26" width="200" height="150" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_3" >
> <dc:Bounds x="460" y="67" width="92" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_4" >
> <dc:Bounds x="584" y="67" width="48" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_5" >
> <dc:Bounds x="96" y="67" width="100" height="48" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNShape bpmnElement="_6" >
> <dc:Bounds x="96" y="67" width="140" height="148" />
> </bpmndi:BPMNShape>
> <bpmndi:BPMNEdge bpmnElement="_21-_2" >
> <di:waypoint x="140" y="50" />
> <di:waypoint x="144" y="117" />
> </bpmndi:BPMNEdge>
> <bpmndi:BPMNEdge bpmnElement="_2-_3" >
> <di:waypoint x="42" y="49" />
> <di:waypoint x="140" y="50" />
> </bpmndi:BPMNEdge>
> <bpmndi:BPMNEdge bpmnElement="_3-_6" >
> <di:waypoint x="146" y="91" />
> <di:waypoint x="328" y="91" />
> </bpmndi:BPMNEdge>
> <bpmndi:BPMNEdge bpmnElement="_1-_5" >
> <di:waypoint x="328" y="91" />
> <di:waypoint x="506" y="91" />
> </bpmndi:BPMNEdge>
> <bpmndi:BPMNEdge bpmnElement="_5-_21" >
> <di:waypoint x="506" y="91" />
> <di:waypoint x="608" y="91" />
> </bpmndi:BPMNEdge>
> <bpmndi:BPMNEdge bpmnElement="_6-_4" >
> <di:waypoint x="40" y="91" />
> <di:waypoint x="146" y="91" />
> </bpmndi:BPMNEdge>
> </bpmndi:BPMNPlane>
> </bpmndi:BPMNDiagram>
>
>
> </definitions>
*Java code:-*
*
*
> import java.util.*;
>
>
> import javax.xml.ws.Endpoint;
>
>
> import org.drools.KnowledgeBase;
> import org.drools.builder.KnowledgeBuilder;
> import org.drools.builder.KnowledgeBuilderFactory;
> import org.drools.builder.ResourceType;
> import org.drools.definition.process.Connection;
> import org.drools.definition.process.Node;
> import org.drools.io.ResourceFactory;
> import org.drools.runtime.StatefulKnowledgeSession;
> import org.drools.runtime.process.NodeInstance;
> import org.drools.runtime.process.WorkItem;
> import org.drools.runtime.process.WorkItemHandler;
> import org.drools.runtime.process.WorkItemManager;
> import org.jbpm.bpmn2.handler.ServiceTaskHandler;
> import org.jbpm.process.instance.ProcessInstance;
> import org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler;
> import org.jbpm.task.service.TaskClientHandler;
> import org.jbpm.workflow.core.node.HumanTaskNode;
> import org.jbpm.workflow.instance.WorkflowProcessInstance;
> import org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl;
>
>
> public class ProcessMain {
>
> public static void main(String[] args) throws Exception {
>
>
>
>
> KnowledgeBase kbase = readKnowledgeBase();
> StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
> TestWorkItemHandler htHandler = new TestWorkItemHandler();
> ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new ServiceTaskHandler());
> ksession.getWorkItemManager().registerWorkItemHandler("Human Task", htHandler);
> Map<String, Object> params = new HashMap<String, Object>();
> params.put("mode", "async");
> WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("WeatherWSServiceProcess", params);
> params = new HashMap<String, Object>();
> params.put("r1", "14025");
> HashMap<String, Object> results = new HashMap<String, Object>();
> results.put("Result", params);
> ksession.getWorkItemManager().completeWorkItem(htHandler.getWorkItem().getId(), results);
> Thread.sleep(5000);
> ksession.getWorkItemManager().completeWorkItem(htHandler.getWorkItem().getId(), null);
>
> }
> static class TestWorkItemHandler implements WorkItemHandler {
>
>
> private static TestWorkItemHandler INSTANCE = new TestWorkItemHandler();
>
>
> private WorkItem workItem;
> private WorkItem aborted;
>
>
> public static TestWorkItemHandler getInstance() {
> return INSTANCE;
> }
>
>
> public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
> this.workItem = workItem;
> }
>
>
> public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
> this.aborted = workItem;
> }
>
>
> public WorkItem getWorkItem() {
> WorkItem result = workItem;
> workItem = null;
> return result;
> }
>
>
> public WorkItem getAbortedWorkItem() {
> WorkItem result = aborted;
> aborted = null;
> return result;
> }
>
>
> }
> }
>
*Error:-*
*
*
> Get zip code result is {r1=14025}
>
> java.lang.ClassNotFoundException:
>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/795331#795331]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 10 months