<div dir="ltr"><div>Hey Alexander, </div><div><br></div>Would this be related to this?<div><br></div><div><a href="https://issues.jboss.org/browse/DROOLS-243">https://issues.jboss.org/browse/DROOLS-243</a><br></div><div><br>
</div><div>If it is this one, you can do something like this as a workaround before constructing the KBase:</div><div><br></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px">Operator op = BeforeEvaluatorDefinition.BEFORE;</span><br style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px">
<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px">Operator op = AfterEvaluatorDefinition.AFTER;</span><br></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px"><br>
</span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px">This will cause the evaluation definition to be put in  memory.</span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px"><br>
</span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px">Hope this helps!</span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px"><br>
</span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px">Demian</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 11, 2013 at 9:21 AM, Alexander Wolf <span dir="ltr">&lt;<a href="mailto:mail@alexander-wolf.net" target="_blank">mail@alexander-wolf.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Drools 5.5.0 Final]<br>
<br>
I wrote a webserver that keeps StatefulKnowledgeSessions running in Stream mode. When the server is stopped, the sessions are serialized and stored in a database. When the server is restarted, the existing sessions are restored / deserialized.<br>

<br>
Some time after recreating the session and inserting some events I get the following exception:<br>
<br>
java.lang.NullPointerException: null<br>
at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedLeft(AfterEvaluatorDefinition.java:351)<br>
...<br>
<br>
Apparently the exception seems to be related to a rule that uses temporal reasoning.<br>
After getting it once, the session seems to be corrupt -&gt; from now on every time I call ksession.insert(event) the same exception occurs.<br>
When I serialize the session and attempt to deserialize it, I get a long stack trace --&gt; I can not deserialize it anymore. (as apparently it is corrupted).<br>
When I run the server with the same events/sessions without stopping (serialization/deserialization) the exception does not occur)<br>
<br>
Can I do anything to prevent this behaviour? I thought maybe the &quot;after&quot; timer/trigger is somehow still active when I serialize the ksession.<br>
I tried ksession.halt() before serialization, but with no effect.<br>
<br>
Any ideas?<br>
<br>_______________________________________________<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></blockquote></div><br></div>