Great news!<br><br>We were in the process of debugging JBPM trying to find the source of the bug ... and maybe days away from the solution ...<br><br>Is
 there any bug report in Jira and/or a patch we can apply without having
 to wait for the next release so we can quick-patch our systems?<br><br><br clear="all">Alberto R. Galdo<br><a href="mailto:argaldo@gmail.com">argaldo@gmail.com</a><br><br><br><div class="gmail_quote">On Wed, Mar 14, 2012 at 13:09, Marco Rietveld <span dir="ltr">&lt;<a href="mailto:mrietvel@redhat.com">mrietvel@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <br>
    Hi Alberto, <br>
    <br>
    This is a bug that has been fixed in jBPM. It had to do with lazy
    initialization of a <font face="Default Sans
      Serif,Verdana,Arial,Helvetica,sans-serif">JPAProcessInstanceManager</font>
    field. <br>
    <br>
    We&#39;ll be releasing a new jBPM version sometime soon (synchronous
    with Drools, I think). The bug is fixed in there. <br>
    <br>
    Regards,<br>
    Marco<br>
    <br>
    03/08/2012 11:32 AM, Alberto R. Galdo:
    <blockquote type="cite"><div><div class="h5"><font face="Default Sans
        Serif,Verdana,Arial,Helvetica,sans-serif">
        <div>Hi, </div>
        <div><br>
        </div>
        <div>  We&#39;re running an application that uses Drools + JBPM 5 +
          Drools integration our set-up can be seen as: </div>
        <div>
          <br>
        </div>
        <div>  Some rule fires and creates a JBPM process ( a fact gets
          inserted into drools using
          &quot;kcontext.getKnowledgeRuntime().startProcess(&quot;testProcess&quot;)&quot;
          ). We have a problem with the persistence of this processes.
          Persistence is implemented with JPA and JTA. Our application
          runs with fireUntilHalt() and when a process is launched from
          the consequence of any of the rules the persistence of the
          process fails. If the application runs with fireAllRules(),
          the persistence works like a charm.</div>
        <div>  </div>
        <div>  The error shown is as follow:</div>
        <div>  </div>
        <div>  Exception in thread &quot;Thread-5&quot; Exception executing
          consequence for rule &quot;Run Process&quot; in com.sample:
          java.lang.NullPointerException</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:754)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:730)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          java.lang.Thread.run(Thread.java:662)</div>
        <div>Caused by: java.lang.NullPointerException</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:44)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1074)</div>
        <div><span style="white-space:pre-wrap"> </span>at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          com.sample.Rule_Run_Process.defaultConsequence(Rule_Run_Process.java:9)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          com.sample.Rule_Run_ProcessDefaultConsequenceInvoker.evaluate(Unknown
          Source)</div>
        <div><span style="white-space:pre-wrap"> </span>at
          org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)</div>
        <div><span style="white-space:pre-wrap"> </span>... 6 more</div>
        <div><span style="white-space:pre-wrap"> </span></div>
        <div><span style="white-space:pre-wrap"> </span>The problem is
          in this function:</div>
        <div><span style="white-space:pre-wrap"> </span></div>
        <div><span style="white-space:pre-wrap"> </span>public void
          addProcessInstance(ProcessInstance processInstance) {</div>
        <div>        ProcessInstanceInfo processInstanceInfo = new
          ProcessInstanceInfo( processInstance,
          this.kruntime.getEnvironment() );</div>
        <div>        ProcessPersistenceContext context </div>
        <div>            = ((ProcessPersistenceContextManager)
          this.kruntime.getEnvironment()</div>
        <div>                    .get(
          EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))</div>
        <div>                    .getProcessPersistenceContext();</div>
        <div>        // @PrePersist added to ProcessInstanceInfo because
          of this</div>
        <div>        context.persist( processInstanceInfo );</div>
        <div>        ((org.jbpm.process.instance.ProcessInstance)
          processInstance).setId( processInstanceInfo.getId() );</div>
        <div>        processInstanceInfo.updateLastReadDate();</div>
        <div>        internalAddProcessInstance(processInstance);</div>
        <div>    }</div>
        <div><span style="white-space:pre-wrap"> </span></div>
        <div><span style="white-space:pre-wrap"> </span>We think after
          that persist sentence, the entity manager would have to run a
          flush sentence for the process instance is inserted into
          database and get the ID.</div>
        <div><span style="white-space:pre-wrap"> </span></div>
        <div><span style="white-space:pre-wrap"> </span>Greets.</div>
      </font>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><div class="im"><pre>_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </div></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <br>
    <pre cols="72">-- 
jBPM/Drools developer
Utrecht, the Netherlands</pre>
  </font></span></div>

</blockquote></div><br>