<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
IOException while storing process instance?
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/jamesbeam">Jim B</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/809700#809700">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>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.  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The issue is that right after my rule fires (right after the output, "started process: 123" - see below) I get the following error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;"><strong>    java.lang.IllegalArgumentException: IOException while storing process instance 123: org.drools.common.NamedEntryPoint</strong></span></p><p><span style="font-family: courier new,courier;"><strong>    org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:207)</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>If I insert null or a string instead of the fact handle, everything works fine.  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">rule "TestRule4"</span></p><p><span style="font-family: courier new,courier;">  no-loop true</span></p><p><span style="font-family: courier new,courier;">  dialect "java"</span></p><p><span style="font-family: courier new,courier;">when</span></p><p><span style="font-family: courier new,courier;">   $meb: MyEventBean(style matches ".*western.*")</span></p><p><span style="font-family: courier new,courier;">   not ($mb : MarkerBean(title matches $meb.getTitle()))</span></p><p><span style="font-family: courier new,courier;">then</span></p><p><span style="font-family: courier new,courier;">  // first get the fact handle and pass it to the process</span></p><p><span style="font-family: courier new,courier;">  MarkerBean $mb = new MarkerBean();</span></p><p><span style="font-family: courier new,courier;">  Object factHandle = kcontext.getKnowledgeRuntime().insert($mb);</span></p><p><span style="font-family: courier new,courier;">  System.out.println("got object:"+factHandle.getClass().getName());   <=== prints org.drools.common.DefaultFactHandle</span></p><p><span style="font-family: courier new,courier;">  java.util.Map<String,Object> variables = new java.util.HashMap<String,Object>();</span></p><p><span style="font-family: courier new,courier;">  variable.put("markerHandle",factHandle)</span></p><p><span style="font-family: courier new,courier;">  WorkflowProcessInstance pi = (WorkflowProcessInstance)kcontext.getKnowledgeRuntime().createProcessInstance("test.SimpleProcess", variables);</span></p><p>  </p><p><span style="font-family: courier new,courier;">  //store the new processinstance in the new MarkerBean (so I can later signal it)</span></p><p><span style="font-family: courier new,courier;">  $mb.setTitle($meb.getTitle());</span></p><p><span style="font-family: courier new,courier;">  $mb.setProcessInstanceId(pi.getId());</span></p><p><span style="font-family: courier new,courier;">  update($mb)</span></p><p>  </p><p><span style="font-family: courier new,courier;">  kcontext.getKnowledgeRuntime().startprocessInstance(pi.getId());</span></p><p><span style="font-family: courier new,courier;">  System.out.println("started process "+pi.getId());</span></p><p><span style="font-family: courier new,courier;">end</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Does anyone see anything here that could be causing a problem?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks vm!</p><p>-J</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/809700#809700">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>