<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body 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'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
cite="mid:CADrEBQGXUytqVyuYTEVM-ZMOpVegSYLL_T8M70UXJn3645Xs7g@mail.gmail.com"
type="cite"><font face="Default Sans
Serif,Verdana,Arial,Helvetica,sans-serif">
<div>Hi, </div>
<div><br>
</div>
<div> We'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
"kcontext.getKnowledgeRuntime().startProcess("testProcess")"
). 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 "Thread-5" Exception executing
consequence for rule "Run Process" 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 class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
jBPM/Drools developer
Utrecht, the Netherlands</pre>
</body>
</html>