[rules-users] Rules doubt

Wolfgang Laun wolfgang.laun at gmail.com
Tue May 4 01:59:51 EDT 2010


Puneet,

this is what I do to load rules and start a session:


        File drl = new File( getDrlPath() );

        ruleBase = RuleBaseFactory.newRuleBase();
        PackageBuilder pb = new PackageBuilder();
        Reader fr = new FileReader( drl );
        pb.addPackageFromDrl( fr );

        if( pb.hasErrors() ){
            PackageBuilderErrors errors = pb.getErrors();
            for( DroolsError err: errors.getErrors() ){
                System.err.println( err.toString() );
            }
            return;  // or whatever you need to do in your environment to
abort
        }

        ruleBase.addPackages( pb.getPackages() );
        session = ruleBase.newStatefulSession();

and this is the error message that's printed due to a comparable error:
Rule Compilation error : [Rule name='ruleB']
    appl/activation/Rule_ruleB_0.java (10:524) : The method setName(String)
in the type Thing is not applicable for the arguments (Double)

-W


2010/5/4 Puneet duggal <duggalpunit at gmail.com>

> This is My rule
>
>
> rule "Area_SquareFt_01_10-01-09_12-31-14"
> date-effective "01-Oct-2009" date-expires "31-Dec-2014"  salience 6
>  no-loop true
>   when
>  eval(BusinessLogic.gettest("Inside Area_SquareFt_01_10-01-09_12-31-14
> executed"))
>  objectP2483 : Para_2483( (fid2335=="Block") && (fid2336=="16") );
>
>  then
>  System.out.println("Area_SquareFt_01_10-01-09_12-31-14 executed");
>  objectP2483.setFid31003(new Double(497)); end
>
>
>
>  here My 31003 is a String  field   but i am assigning a Double in it  so
> that should'nt
>  work . But  the problem is because of this my all remmaning rules also
> stoped working.
> And it took 2 hours to detect it because the execute() method dosent
> through any error.
> So how can we detect these situation earlier ,so as to catch the problem
> early and why my the remm
> rules stoped woking because on this.
>
>
>
>
> On 5/4/10, tolitius <webakaunt at gmail.com> wrote:
>>
>>
>> @Puneet,
>>
>>    Examples would be useful to understand what kind of problem you are
>> having. As to
>> Puneet wrote:
>> > how can I detect which exact business rule is having error
>>
>>    Check out "Debugging Rules" section of Drools documentation:
>> http://bit.ly/9PRDRJ
>>
>> @Wolfgang,
>>
>>    No need to be a hater Wolfgang, the question is simple. I agree,
>> examples would be helpful, but that is NOT how you grow a friendly
>> community.
>>
>>    Community is the biggest problem JBoss has. Why is it so inhumanly
>> difficult to be polite and considerate?
>>
>> /Anatoly
>>
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p775029.html
>> Sent from the Drools - User mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> 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/20100504/b22ed7b4/attachment.html 


More information about the rules-users mailing list