[rules-users] AfterEvaluatorDefinition NullPointer Exception in deserialized ksession

Demian Calcaprina calcacuervo at gmail.com
Fri Oct 11 10:09:12 EDT 2013


Hey Alexander,

Would this be related to this?

https://issues.jboss.org/browse/DROOLS-243

If it is this one, you can do something like this as a workaround before
constructing the KBase:

Operator op = BeforeEvaluatorDefinition.BEFORE;
Operator op = AfterEvaluatorDefinition.AFTER;

This will cause the evaluation definition to be put in  memory.

Hope this helps!

Demian


On Fri, Oct 11, 2013 at 9:21 AM, Alexander Wolf <mail at alexander-wolf.net>wrote:

> [Drools 5.5.0 Final]
>
> 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.
>
> Some time after recreating the session and inserting some events I get the
> following exception:
>
> java.lang.NullPointerException: null
> at
> org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedLeft(AfterEvaluatorDefinition.java:351)
> ...
>
> Apparently the exception seems to be related to a rule that uses temporal
> reasoning.
> After getting it once, the session seems to be corrupt -> from now on
> every time I call ksession.insert(event) the same exception occurs.
> When I serialize the session and attempt to deserialize it, I get a long
> stack trace --> I can not deserialize it anymore. (as apparently it is
> corrupted).
> When I run the server with the same events/sessions without stopping
> (serialization/deserialization) the exception does not occur)
>
> Can I do anything to prevent this behaviour? I thought maybe the "after"
> timer/trigger is somehow still active when I serialize the ksession.
> I tried ksession.halt() before serialization, but with no effect.
>
> Any ideas?
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131011/02912afa/attachment-0001.html 


More information about the rules-users mailing list