<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"><<a href="mailto:c.raschl@dyless.com">c.raschl@dyless.com</a>></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">> I'm using the latest drools and drools flow snapshot with jpa persistence.<br>
><br>
> When I'm retracting a fact from the knowledge session (which causes<br>
> logical retraction), the session can't be persisted any more.<br>
><br>
> During retraction a LogicalRetractCallback is instantiated using this<br>
> constructor:<br>
><br>
> public LogicalRetractCallback(final TruthMaintenanceSystem tms,<br>
> final LogicalDependency node,<br>
> final Set set,<br>
> final InternalFactHandle handle,<br>
> final PropagationContext context,<br>
> final Activation activation) {<br>
> this.tms = tms;<br>
> this.node = node;<br>
> this.set = set;<br>
> this.handle = handle;<br>
> this.context = context;<br>
> }<br>
><br>
> As you can see an activation object can be passed (and actually is<br>
> passed) to the constructor, but is never used. Retraction works though.<br>
><br>
> The problem occurs when the knowledge session is persisted, because<br>
> LogicalRetractCallback.write assumes that activation is not null, which<br>
> leads to this npe:<br>
><br>
> Caused by: java.lang.NullPointerException<br>
> org.drools.common.TruthMaintenanceSystem$LogicalRetractCallback.write(TruthMaintenanceSystem.java:251)<br>
> 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 "context.terminalTupleMap.get( this.activation.getTuple() )"<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'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>