<!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.&#160; (FYI, I'm passing the facthandle because I want the process to retract the object I created before it ends.&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p><span style="font-family: courier new,courier;"><strong>&#160;&#160;&#160; 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>&#160;&#160;&#160; org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:207)</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If I insert null or a string instead of the fact handle, everything works fine.&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>MY GOAL:&#160; 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.&#160; I use a "MarkerBean" to determine whether or not a related process already exists.&#160; When a process ends, it needs to remove the related MarkerBean.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The following rule is giving me the exception.&#160; Here, an object (MyEventBean) has been inserted and I am looking to see if there is a corresponding MarkerBean.&#160; Then, I create the process and new markerbean if necessary:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">rule "TestRule4"</span></p><p><span style="font-family: courier new,courier;">&#160; no-loop true</span></p><p><span style="font-family: courier new,courier;">&#160; dialect "java"</span></p><p><span style="font-family: courier new,courier;">when</span></p><p><span style="font-family: courier new,courier;">&#160;&#160; $meb: MyEventBean(style matches ".*western.*")</span></p><p><span style="font-family: courier new,courier;">&#160;&#160; 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;">&#160; // first get the fact handle and pass it to the process</span></p><p><span style="font-family: courier new,courier;">&#160; MarkerBean $mb = new MarkerBean();</span></p><p><span style="font-family: courier new,courier;">&#160; Object factHandle = kcontext.getKnowledgeRuntime().insert($mb);</span></p><p><span style="font-family: courier new,courier;">&#160; System.out.println("got object:"+factHandle.getClass().getName());&#160;&#160; &lt;=== prints org.drools.common.DefaultFactHandle</span></p><p><span style="font-family: courier new,courier;">&#160; java.util.Map&lt;String,Object&gt; variables = new java.util.HashMap&lt;String,Object&gt;();</span></p><p><span style="font-family: courier new,courier;">&#160; variable.put("markerHandle",factHandle)</span></p><p><span style="font-family: courier new,courier;">&#160; WorkflowProcessInstance pi = (WorkflowProcessInstance)kcontext.getKnowledgeRuntime().createProcessInstance("test.SimpleProcess", variables);</span></p><p>&#160; </p><p><span style="font-family: courier new,courier;">&#160; //store the new processinstance in the new MarkerBean (so I can later signal it)</span></p><p><span style="font-family: courier new,courier;">&#160; $mb.setTitle($meb.getTitle());</span></p><p><span style="font-family: courier new,courier;">&#160; $mb.setProcessInstanceId(pi.getId());</span></p><p><span style="font-family: courier new,courier;">&#160; update($mb)</span></p><p>&#160; </p><p><span style="font-family: courier new,courier;">&#160; kcontext.getKnowledgeRuntime().startprocessInstance(pi.getId());</span></p><p><span style="font-family: courier new,courier;">&#160; 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;">&#160;</p><p>For grins I added DefaultFactHandle ( to my persistence.xml, didn't help.&#160; 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;">&#160;</p><p>Does anyone see anything here that could be causing a problem?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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>