<div>    Chris,</div><div><br></div><div>    I will look into this problem, but I am not sure how to reproduce it. Maybe you can provide me a test case? If so, please open a JIRA, attached your test case and ping me.</div>
<div><br></div><div>    Thanks,</div><div>        Edson</div>   <br><br><div class="gmail_quote">2010/8/10 Chris Raschl <span dir="ltr">&lt;<a href="mailto:c.raschl@dyless.com">c.raschl@dyless.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
Just in case someone faces the same problem, comments inline:<br>
<br>
Am 05.08.2010 13:53, schrieb Chris Raschl:<br>
<div class="im">&gt; I&#39;m using the latest drools and drools flow snapshot with jpa persistence.<br>
&gt;<br>
&gt; When I&#39;m retracting a fact from the knowledge session (which causes<br>
&gt; logical retraction), the session can&#39;t be persisted any more.<br>
&gt;<br>
&gt; During retraction a LogicalRetractCallback is instantiated using this<br>
&gt; constructor:<br>
&gt;<br>
&gt; public LogicalRetractCallback(final TruthMaintenanceSystem tms,<br>
&gt;                                 final LogicalDependency node,<br>
&gt;                                 final Set set,<br>
&gt;                                 final InternalFactHandle handle,<br>
&gt;                                 final PropagationContext context,<br>
&gt;                                 final Activation activation) {<br>
&gt;       this.tms = tms;<br>
&gt;       this.node = node;<br>
&gt;       this.set = set;<br>
&gt;       this.handle = handle;<br>
&gt;       this.context = context;<br>
&gt; }<br>
&gt;<br>
&gt; As you can see an activation object can be passed (and actually is<br>
&gt; passed) to the constructor, but is never used. Retraction works though.<br>
&gt;<br>
&gt; The problem occurs when the knowledge session is persisted, because<br>
&gt; LogicalRetractCallback.write assumes that activation is not null, which<br>
&gt; leads to this npe:<br>
&gt;<br>
&gt; Caused by: java.lang.NullPointerException<br>
&gt; org.drools.common.TruthMaintenanceSystem$LogicalRetractCallback.write(TruthMaintenanceSystem.java:251)<br>
&gt; org.drools.marshalling.impl.OutputMarshaller.writeActionQueue(OutputMarshaller.java:201)<br>
<br>
</div>Adding this.activation = activation to the constructor does not help,<br>
beause the npe in the write method remains. I tried it, then the whole<br>
expression &quot;context.terminalTupleMap.get( this.activation.getTuple() )&quot;<br>
in the write method evaluates to null...<br>
<br>
I found out persistence was triggered by an unneccessary flush in my<br>
code. I removed that, everything works now.<br>
<br>
That seems to be the case because the action queue is empty then and<br>
there&#39;s no need to persist it, thus the write method is never called. I<br>
guess the problem remains if someone tries to persist a session with an<br>
action queue containing a LogicalRetractCallback object.<br>
<font color="#888888"><br>
- chris<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>