[rules-users] Re: query on "modify"

Alexander Claus styjdt at claus4joy.de
Tue Jun 24 10:27:34 EDT 2008


> package com.sample
>
> import org.domain.CreditCard;
>
> rule "Credit Eligibility"
>    no-loop true
>    when
>        cc : CreditCard( age > 18, annualIncome > 50000, asset> 500000  )
>    then
>        cc.setEligibilityStatus( "Eligible for credit card" );
>        System.out.println("Valid Credit Score ");
>        modify( cc );
> end
>
> I was successfully  able to run the rule against my CreditCard object.
> However, when I tried running it from withing my applicaiton by embedding 
> drools(latest, the following error occurs:
>
> org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule 
> name=Credit Eligibility, agendaGroup=MAIN, salience=0, no-loop=true]
>    com/sample/Rule_Credit_Eligibility_0.java (13:652) : The method 
> modify(CreditCard) is undefined for the type Rule_Credit_Eligibility_0

Obviously your "modify(cc);" is considered as a method...
Try change this line to "modify(cc) {}" or better, put the modification of 
the cc (setElig...) inside the curly brackets: "modify(cc) { setElig... };

Alexander 




More information about the rules-users mailing list