[jBPM] - jBPM5.3 LocalHumanTaskService
by hua zhong
hua zhong [https://community.jboss.org/people/ghuazh] created the discussion
"jBPM5.3 LocalHumanTaskService"
To view the discussion, visit: https://community.jboss.org/message/739520#739520
--------------------------------------------------------------
Hi, all
I'm using jBPM5.3 final in our project, and try to use local human task handler.
I got too many problems need someone help me.
1. to start a process:
Map<String, Object> params = new HashMap<String, Object>();
params.put("act_rule_launcher", "krisv");
params.put("act_rule_dept_manager", "john");
params.put("act_checker", "mary");
params.put("act_approver", "tracy");
StatefulKnowledgeSession ksession = BPM.getBPMService().getSession("com.tmt");
HTWorkItemHandler handler = new HTWorkItemHandler(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
ksession.startProcess("com.tmt.ProjectPlanApproval", params);
HTWorkItemHandler is a local work item extends AbstractHTWorkItemHandler.
Exception:
0 03/06 18:06:18,379[UIThread [1gpcqnco5rnu6n5d7u3otffrb]] ERROR hibernate.transaction.JDBCTransaction.toggleAutoCommit - Could not toggle autocommit
java.sql.SQLException: autocommit is not allowed on a resource enlisted in a global transaction
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.setAutoCommit(JdbcConnectionHandle.java:177)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
I guess maybe I need to change persistence.xml to use JTA?
<persistence-unit name="org.jbpm.task">
change to:
<persistence-unit name="org.jbpm.task" transaction-type="JTA">
After that, It's ok. but soon I got the 2nd problem, see below.
2. complete a task
HTTaskService service = BPM.getHumanTaskService().getTaskService();
List<TaskSummary> tasks = service.getTasksAssignedAsPotentialOwner(userId,"en-UK");
if(tasks.isEmpty()){
return;
}
for(int i =0;i<tasks.size();i++){
TaskSummary task = tasks.get(i);
System.out.println(userId+">>"+task.getId()+task.getName());
}
long taskId = tasks.get(0).getId();
service.start(taskId, userId);
service.complete(taskId, userId,null);
HTTaskService is a taskservice extends LocalTaskService.
BPM.getHumanTaskService().getTaskService() will return a new HTTaskService from a org.jbpm.task.service.TaskService.
in my application only one org.jbpm.task.service.TaskService will created, every HTTaskService whil use it.
service.start is ok.
but when service complete, it brings a new exception:
javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:458)
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:431)
at org.drools.persistence.jpa.JpaPersistenceContextManager.beginCommandScopedEntityManager(JpaPersistenceContextManager.java:83)
at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:75)
at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:204)
at org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1100)
at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:297)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:117)
at com.sg.bpm.service.task.HTWorkItemHandler$TaskCompletedHandler.execute(HTWorkItemHandler.java:165)
at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:307)
at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:73)
at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:46)
at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:502)
at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:468)
at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:80)
I test task client of HornetQ, everything is ok. but how to use local service?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739520#739520]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 7 months
[Beginner's Corner] - getting started unit testing - embedded JBoss AS 7?
by Matthew Cornell
Matthew Cornell [https://community.jboss.org/people/matthewcornell] created the discussion
"getting started unit testing - embedded JBoss AS 7?"
To view the discussion, visit: https://community.jboss.org/message/739439#739439
--------------------------------------------------------------
Hi Folks. I'm just getting started with JBoss AS 7, having tried and ultimately failed to get GlassFish Embedded working for my Java EE 6 app's unit tests. Please tell me: How do I go about using JBoss to do unit tests without having the server up and running? I'm hoping that all I need is a) a .jar file (ideally one!) and b) some simple code for starting the in-memory server, configuring it, and then shutting it down. An example would be awesome! I've searched for "jboss embedded," but what I found was not on the mark or was outdated. I found the JBoss Embedded community at https://community.jboss.org/community/jbossas/embedded https://community.jboss.org/en/jbossas/embedded, but it's really dead, which is discouraging. The articles at https://community.jboss.org/docs/DOC-13843 https://community.jboss.org/wiki/JBossEmbeddedAS haven't been touched in two years. I found a bunch of mentions of Arquillian, but I'm not familiar with it. Finally, the ultimate icing on the cake would be to do this without Maven. Is what I'm trying to do so strange? I saw a presentation by one of the JBoss leaders, who touted its applicability specifically for embedded unit testing, so maybe I'm using the wrong terminology in my search. Thanks in advance -- matt
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739439#739439]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 7 months
[Datasource Configuration] - persistence.xml does not deploy
by ora7
ora7 [https://community.jboss.org/people/ora7] created the discussion
"persistence.xml does not deploy"
To view the discussion, visit: https://community.jboss.org/message/738055#738055
--------------------------------------------------------------
Hello
I have configured a PhysicsDS datasource. It can be deployed, the database is created.
I try to use it in my persistence.xml. But it does not deploy.
I get the error:
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "persistence.unit:unitName=physics.ear/physics-ejb.jar#physicsdb" is missing the following dependencies:
Dependency "jboss.jca:name=PhysicsDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=PhysicsDS,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss.jca:name=PhysicsDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=PhysicsDS,service=DataSourceBinding' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(
) [:2.2.2.GA]
Must I add more information in the persistence.xml? I does not understand it. Is it meaning a datasourcebinbding property is missing?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/738055#738055]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 7 months
[jBPM] - Re: Unable to complete a task when running the task in a separate thread
by Dino Antonelli
Dino Antonelli [https://community.jboss.org/people/dino.antonelli] created the discussion
"Re: Unable to complete a task when running the task in a separate thread"
To view the discussion, visit: https://community.jboss.org/message/739390#739390
--------------------------------------------------------------
Hi Kris,
I've the same problem as Connie. I've a different thread that is running the handler and I'm also experiencing the above NullPointerException during the its execution. I've passed, as you suggested, the ksession to the handler so I call "ksession.getWorkItemManager().completeWorkItem" to complete the execution. Anyway I'm getting the exception very frequently. I've read that there must be a transaction to have a successful complete but it seems that the thread that makes the call always run inside a transaction; below my snippet of code:
TransactionManager tm = TransactionManagerLocator.getInstance().locate();
boolean transactionStarted = false;
if(tm.getStatus() == Status.STATUS_NO_TRANSACTION) {
transactionStarted = true;
tm.begin();
}
this.ksession.getWorkItemManager().completeWorkItem(wi.getId(), inputParameters);
if(transactionStarted) {
tm.commit();
}
It seems that I've never execute the begin because thre's always an active transaction.
Have you any idea?
thnks in advance
Dino
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/739390#739390]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 7 months