[jBPM] - TaskService Referential integrity constraint violation
by Gary Struthers
Gary Struthers [http://community.jboss.org/people/GaryS] created the discussion
"TaskService Referential integrity constraint violation"
To view the discussion, visit: http://community.jboss.org/message/620882#620882
--------------------------------------------------------------
I wondered why there are examples of session persistence and separate examples of TaskServer but none I can find of both of them together.
I'm still trying to make them work together and it's still problematic. I start the taskServer with
<persistence-unit name="org.drools.task"> then, in main, I create
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA"> with a fully qualified classname for
org.jbpm.persistence.processinstance.ProcessInstanceInfo
But when I start the process
Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)
Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)
0 12/08 12:40:18,491[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:
insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]
5 12/08 12:40:18,496[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:
insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]
Hibernate: update ProcessInstanceInfo set lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?
13 12/08 12:40:18,504[NioProcessor-1] ERROR event.def.AbstractFlushingEventListener.performExecutions - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620882#620882]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[jBPM] - Tasks Assigned to Groups Not Found
by James Williams
James Williams [http://community.jboss.org/people/williajd] created the discussion
"Tasks Assigned to Groups Not Found"
To view the discussion, visit: http://community.jboss.org/message/614902#614902
--------------------------------------------------------------
Hi,
I'm using JBPM 5.1 Final and have spent a couple of hours learning how tasks are returned from the TaskService. I believe I have found a bug in the way tasks are returned when they are not assigned to a particular user.
I have 2 simple processes that I'm using to test my code. I'm making sure I can create a process and then return the first tasks from them.
The first one SimpleHumanTaskProcess has a single task with the owner id set to "testUser". When I create the process I can use the TaskClient.getTasksOwned method to return the created tasks as expected. When I look in the database the tasks are there and have owner and creator set to "testUser".
The second process is called SimpleGroupTaskProcess and has a single Human Task that has groupId = "testGroup". The process is created properly and I am able to examine the database and noticed that the task owner and creator are not set. The potential owner DOES include the "testGroup" so I would expect it to be found. Howevewr it is not retrieved when using the TaskClient.getTasksAssignedAsPotentialOwner passing in the user "testUser" and group "testGroup".
After some digging I think I have found the problem. The key is that the creator and owner is not set on the task. I found the underlying named query called "TasksAssignedAsPotentialOwnerWithGroups" in the orm.xml file. The query was not taking into account the null creator and owner so was only returning the tasks belonging to the "testUser" but not the group assignment.
|| *Old
* || *New
* ||
| select
new org.jbpm.task.query.TaskSummary(
t.id,
t.taskData.processInstanceId,
name.text,
subject.text,
description.text,
t.taskData.status,
t.priority,
t.taskData.skipable,
t.taskData.actualOwner,
t.taskData.createdBy,
t.taskData.createdOn,
t.taskData.activationTime,
t.taskData.expirationTime)
from
Task t
left join t.taskData.createdBy
left join t.taskData.actualOwner
left join t.subjects as subject
left join t.descriptions as description
left join t.names as name,
OrganizationalEntity potentialOwners
where
( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and
potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and
(
name.language = :language
or t.names.size = 0
) and
(
subject.language = :language
or t.subjects.size = 0
) and
(
description.language = :language
or t.descriptions.size = 0
) and
t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and
t.taskData.expirationTime is nul | select
new org.jbpm.task.query.TaskSummary(
t.id,
t.taskData.processInstanceId,
name.text,
subject.text,
description.text,
t.taskData.status,
t.priority,
t.taskData.skipable,
owner,
creator,
t.taskData.createdOn,
t.taskData.activationTime,
t.taskData.expirationTime)
from
Task t
left join t.taskData.createdBy as creator
left join t.taskData.actualOwner as owner
left join t.subjects as subject
left join t.descriptions as description
left join t.names as name,
OrganizationalEntity potentialOwners
where
( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and
potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and
(
name.language = :language
or t.names.size = 0
) and
(
subject.language = :language
or t.subjects.size = 0
) and
(
description.language = :language
or t.descriptions.size = 0
) and
t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') and
t.taskData.expirationTime is null |
This appears to work.
I do have a couple of questions though. Should tasks be created in the database without having at least a creator id? Is this expected behaviour for tasks assigned to groups?
I have attached my processes, just in case there is something I've done wrong that someone can help me with.
Thanks
James
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/614902#614902]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[jBPM] - TaskClient not connecting
by npereira
npereira [http://community.jboss.org/people/npereira] created the discussion
"TaskClient not connecting"
To view the discussion, visit: http://community.jboss.org/message/603466#603466
--------------------------------------------------------------
Hi forum,
I have been looking at JBPM5 API and I have a problem connecting to TaskClient from a different server.
So I have my JBPM5.1 server, running.
But from another machine I want to be able to connect to the JBPM5.1 and query the Human Task Service.
Now the problem is that if I query it from localhost or 127.0.0.1, it works fine.
*TaskClient client = new TaskClient(new MinaTaskClientConnector("JBPM Interface", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));*
*client.connect("127.0.0.1", 9123);*
But from another machine, running the same code, from another machine, it says that it cannot connect.
*TaskClient client = new TaskClient(new MinaTaskClientConnector("JBPM Interface", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));*
*client.connect("10.1.5.13", 9123);*
Now I have tried this on diferent machine and the result is the same.
I have read here in the forum that this is possible, even connect multiple machines to the same Human Task Service.
Do I need to be looking at some configuration? (I have the install.demo config)
Regards,
Nelson
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/603466#603466]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[jBPM] - CommandBasedWSHumanTaskHandler session, client ???
by Gary Struthers
Gary Struthers [http://community.jboss.org/people/GaryS] created the discussion
"CommandBasedWSHumanTaskHandler session, client ???"
To view the discussion, visit: http://community.jboss.org/message/620982#620982
--------------------------------------------------------------
To persist a session, I'm trying to use CommandBasedWSHumanTaskHandler in code based on Salaboy's PersistentProcessManager and TaskClientHelper with Mina
private StatefulKnowledgeSession getKnowledgeSession() {
StatefulKnowledgeSession ksession = null;
if (ksessionId == null) {
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(
kbase,
null,
env);
ksessionId = ksession.getId();
} else {
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(
ksessionId,
kbase,
null,
env);
}
humanActivitiesHandler = new CommandBasedWSHumanTaskHandler(ksession);
humanActivitiesHandler.setClient(TaskClientHelper.getInstance().taskClient);
this.workItemsHandlers.put("Human Task", humanActivitiesHandler);
for (Map.Entry<String, WorkItemHandler> entry : this.workItemsHandlers.entrySet()) {
ksession.getWorkItemManager().registerWorkItemHandler(entry.getKey(), entry.getValue());
}
//Configures a logger for the session
KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
return ksession;
}
The handler only accepts a session in the constructor so I guess I'm supposed to construct one every time I get a session from the database and then hope resisterWorkItem works correctly. This doesn't look good. I wish I could create the handler once and then bind it to a session when I have one. I don't know if creating these handlers is idempotent. Then I tried exposing the TaskClient and passing it to the new handler.
Inside the handler the connect method creates a WSHumanTaskHandler. This looks like a bug.
public class CommandBasedWSHumanTaskHandler implements WorkItemHandler {
...
public void connect() {
if (client == null) {
client = new TaskClient(new MinaTaskClientConnector("org.drools.process.workitem.wsht.WSHumanTaskHandler",
new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
boolean connected = client.connect(ipAddress, port);
if (!connected) {
throw new IllegalArgumentException("Could not connect task client");
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620982#620982]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[jBPM] - ProcessMgmtFacade.java - Custom REST Call
by Tobias Wittur
Tobias Wittur [http://community.jboss.org/people/tob1as] created the discussion
"ProcessMgmtFacade.java - Custom REST Call"
To view the discussion, visit: http://community.jboss.org/message/621001#621001
--------------------------------------------------------------
Hi,
I am trying to do a REST call that basically triggers a message based process start. Therefore, I want to implement my own REST API.
I came across this post:
http://community.jboss.org/message/612597#612597#612597 http://community.jboss.org/message/612597#612597
Here, the recommendation is to go to
*jbpm\jboss-5.1.0.GA\server\default\deploy\jbpm-gwt-console-server\WEB-INF\classes\org\jboss\bpm\console\server*
and edit the *ProcessMgmtFacade.java* file.
First, is this not bad practice, since any update would overwrite my changes? I thought I would rather write my own file and leave the old file untouched?! How would you solve this issue?
Therefore I would like to know:
Hhow can I for example route http://localhost:8080/gwt-console-server/rs/process/definitions http://localhost:8080/gwt-console-server/rs/process/definitions to my own java file?
Where is it defined, that http://localhost:8080/gwt-console-server/rs/process/definitions http://localhost:8080/gwt-console-server/rs/process/definitions points to ProcessMgmtFacade.java ?
Just for trial, I tried to import it as a project into eclipse. However, I noticed it is not a java project. Is there a versoin with .project availalbe?
I would be grateful for hints.
Best regards and thank you for help in advance,
Tobias
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/621001#621001]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[jBPM] - Community Contribution to User Guide?
by Tobias Wittur
Tobias Wittur [http://community.jboss.org/people/tob1as] created the discussion
"Community Contribution to User Guide?"
To view the discussion, visit: http://community.jboss.org/message/620988#620988
--------------------------------------------------------------
Hi,
I ve been fiddling around with jBPM for about 2 weeks and I realized that I quickly reached a point where the user guide could not help me anymore. To be honest, it was sometimes a bit frustrating.
In my opinion, there are quite a few stumbling blocks with jBPM especially for novice users. The documentation however, does not make it much easier. Most of the information is dispersed in different blogs, wikis and forum posts. I really appreciate the support that I received in this forum, however, it slows you down of course - if you have to wait for a reply.
Especially the tooling side could be better documented. My personal perception is, following the issue tracker a bit, that there is a lot of work about to be done for the tooling side. Since there are changes/new features about to come, it would be good if there was more involvement from the community in the user guide. So the user guide can be up to date.
Therefore my question, how exaclty can we contribute to the user guide and enrich it, so that other beginners have it a little bit easier? Is that possible already and I just did not see where?
Best regards,
Tobias
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620988#620988]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months