1 Reply Latest reply on Oct 17, 2013 6:17 AM by mvermand

    IOException while storing process instance?

    Newbie

      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

       

      [UPDATE]

      I created a simple process: start->timer->end  and a little java app to run it.  I have one process variable that is of type org.drools.runtime.rule.Facthandle.

      In my little test java app, I can start the process, but just like in my rule, if I insert an object and pass its facthandle I get the same exception as above. 

      Further, I added a processEventListener and the afterProcessStarted, and afterVariableChanged methods are reached before the exception is thrown (I assume the timer causes a safe point and thus there is an attempt to persist the process?)    Thanks again for any thoughts.

        • 1. Re: IOException while storing process instance?
          mvermand Newbie

          Hi Jim,

           

          I got the same exception but in a different context. It popped when my JBPM5 processInstance was persisted.

          I had added a variable of type Object to my processInstance. This caused the exception.

          After adding the interface "java.io.Serializable" to my variable object class, the exception disappeared.

          Maybe you can check if your MarkerBean implements java.io.Serializable?

           

          Michiel