[rules-users] Global variable error message

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jan 20 02:13:36 EST 2012


Trying to set an undeclared global is done via an API call; basically
there's just one thing that can go wrong.

Using a global that has not been initialized at all, or incorrectly initialized
might cause a NullPointerException or several other unpleasant errors.
Moreover, it may happen anywhere in consequence code or even in a
LHS condition), and so the stack dump isn't quite as simple as in the
other scenario.

FWIW, I find that the stack trace does provide a very good indication
where the problem is. With 5.3.0 final I see for globalDate == null:

Caused by: [Error: null pointer or function not found: getTime]
[Near : {... dob.time >= globalDate.getTime() ....}]

Don't expect a Silver Bullet, just because it's Drools - it's just software ;-)

-W


On 19/01/2012, domingo <sprabakkar at gmail.com> wrote:
> Hi,
> Thanks for your attention,
> I am using global in my rule file(drl), I did some experiment with globals
> my finding as follows...
> 1. declare both rules engine and drl file ==> all fine working properly.
> 2. I intentionaly commented out the global declaration in drl file and set
> the global in the rules engine, it gives very clear error message like
> 'Unexpected global [identifiername]' and rule file is not compiled ==> this
> is also fine very clear what is happening.
> 3. I declare the globals in drl file and intentionally not set the globals
> into rules engine ==> I am getting the following error
> message..."org.drools.runtime.rule.ConsequenceException: rule: XXXXX VVVV
> rule_1"
>
> my question here is the same error why the error message is different and
> test  no 3 . the error message is not clear.
> This makes more difficult in debugging.
> Please let me know if other way of display the correct error messahe. I
> completely check the drools-compiler test files not getting any help.
> drools guru's please advise me.
>
>
> -----
> with kind regards,
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Global-variable-error-message-tp3673889p3673889.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list