[rules-users] NullPointerException while inserting Facts

Sebastian Furth sebastian.furth at googlemail.com
Tue Mar 23 10:57:38 EDT 2010


Hi Thomas,

thanks for your reply. If I got you right, the crash happens because the
following rule will be evaluated if we insert the value "knocking"

rule "R49"
  when
    $value1 : Value(value == "knocking")
    Input(name == "Engine noises" && values contains $value1)
    or
    $value2 : Value(value == "ringing")
    Input(name == "Engine noises" && values contains $value2)
    $solution : SolutionInput(name == "Bad ignition timing")
  then
    $solution.setValue(P5);
end

and the value "ringing" wasn't inserted before?

Thank you in advance for your reply.

Best regards

Sebastian
_____________________________________

Sebastian Furth
Gabelsbergerstraße 6
97080 Würzburg

Tel. 0931-30170294
Mobil. 0171-7592673


2010/3/23 Swindells, Thomas <TSwindells at nds.com>

>  The most likely reason for this is that one of your rules is trying to
> evaluate a value which is null.   The when part of a rule is evaluated as
> the fact is inserted and may be evaluated even if the then part will never
> be reached.
>
>
>
> Looking at your stack trace it looks like the rule involved may have a NOT
> in it.  Have a careful look through your rules and see if there is a case
> where a null pointer may occur and/or try removing them one by one until it
> stops breaking, if that doesn’t work can you post your rules as well.
>
>
>
> Thomas
>
>
>
> *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Sebastian Furth
> *Sent:* 23 March 2010 13:11
> *To:* rules-users at lists.jboss.org
> *Subject:* [rules-users] NullPointerException while inserting Facts
>
>
>
> Hi,
>
> we are currently trying to integrate DROOLS 5.1 in our project.
> In our Project we have two different kinds of Facts, called Values and
> Inputs. We don't have any problems with inserting Input instances but
> sometimes when we try to insert an instance of the Value class (@see:
> http://www.pastie.org/private/juv7hh7rxahpluo5agu3q) we get the following
> NullPointerException:
>
> java.lang.NullPointerException
>     at org.drools.reteoo.LeftTuple.get(LeftTuple.java:265)
>     at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)
>     at
> org.drools.rule.VariableRestriction$ObjectVariableContextEntry.updateFromTuple(VariableRestriction.java:320)
>     at
> org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:119)
>     at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:98)
>     at
> org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
>     at
> org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:34)
>     at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:123)
>     at
> org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:145)
>     at
> org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:57)
>     at
> org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)
>     at
> org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
>     at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
>     at
> org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
>     at
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344)
>     at
> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
>     at
> org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
>     at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
>     at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
>     at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
>     at
> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
>     at de.d3web.we.drools.DroolsAction.addFacts(DroolsAction.java:296)
>     at
> de.d3web.we.drools.DroolsAction.createKnowledgeSession(DroolsAction.java:268)
>     at de.d3web.we.drools.DroolsAction.execute(DroolsAction.java:67)
>
> The weird thing is that we don't get this exception with all instances of
> the Value class - some of them can be inserted, others not. The objects are
> created correctly - we've already debugged this. The crash happens somewhere
> deeper in the drools api.
>
> It would be really great if you could give us a hint how we could fix this
> problem.
>
> Thank you in advance.
>
> Best regards
>
> Sebastian Furth
>
> ------------------------------
>
>
> **************************************************************************************
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmaster at nds.com and delete it from your system as well as any copies.
> The content of e-mails as well as traffic data may be monitored by NDS for
> employment and security purposes. To protect the environment please do not
> print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
> 4EX, United Kingdom. A company registered in England and Wales. Registered
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **************************************************************************************
>
> ------------------------------
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmaster at nds.com and delete it from your system as well as any copies.
> The content of e-mails as well as traffic data may be monitored by NDS for
> employment and security purposes.
> To protect the environment please do not print this e-mail unless
> necessary.
>
> An NDS Group Limited company. www.nds.com
>
> _______________________________________________
> 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/20100323/599e811d/attachment.html 


More information about the rules-users mailing list