Using jBPM 5.4, Hibernate 4, JPA2 I have a rule in which I want to create an object and then start a process with a facthandle to this object as one of the variables. (FYI, I'm passing the facthandle because I want the process to retract the object I created before it ends.
The issue is that right after my rule fires (right after the output, "started process: 123" - see below) I get the following error:
java.lang.IllegalArgumentException: IOException while storing process instance 123: org.drools.common.NamedEntryPoint
org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:207)
If I insert null or a string instead of the fact handle, everything works fine.
MY GOAL: I am inserting objects into working memory and based upon the object, if a related process already exists, I will send a signal to it, if a related process does not already exist I want to create/start one. I use a "MarkerBean" to determine whether or not a related process already exists. When a process ends, it needs to remove the related MarkerBean.
The following rule is giving me the exception. Here, an object (MyEventBean) has been inserted and I am looking to see if there is a corresponding MarkerBean. Then, I create the process and new markerbean if necessary:
rule "TestRule4"
no-loop true
dialect "java"
when
$meb: MyEventBean(style matches ".*western.*")
not ($mb : MarkerBean(title matches $meb.getTitle()))
then
// first get the fact handle and pass it to the process
MarkerBean $mb = new MarkerBean();
Object factHandle = kcontext.getKnowledgeRuntime().insert($mb);
System.out.println("got object:"+factHandle.getClass().getName()); <=== prints org.drools.common.DefaultFactHandle
java.util.Map<String,Object> variables = new java.util.HashMap<String,Object>();
variable.put("markerHandle",factHandle)
WorkflowProcessInstance pi = (WorkflowProcessInstance)kcontext.getKnowledgeRuntime().createProcessInstance("test.SimpleProcess", variables);
//store the new processinstance in the new MarkerBean (so I can later signal it)
$mb.setTitle($meb.getTitle());
$mb.setProcessInstanceId(pi.getId());
update($mb)
kcontext.getKnowledgeRuntime().startprocessInstance(pi.getId());
System.out.println("started process "+pi.getId());
end
For grins I added DefaultFactHandle ( to my persistence.xml, didn't help. As I mentioned, if I add a plain string rather than the factHandle, everything works.
Does anyone see anything here that could be causing a problem?
Thanks vm!
-J