[rules-users] Drools parser error accessing ArrayList.

Wolfgang Laun wolfgang.laun at gmail.com
Wed Apr 11 13:35:55 EDT 2012


This is a different problem now, see droolsjbpm-introduction-docs on
"strict mode". It says that you can configure
    drools.dialect.mvel.strict = false
to avoid such problems.

-W


On 11 April 2012 18:27, groovenarula <gnarula1 at la-z-boy.com> wrote:

> laune,
>
> Unfortunately, the earlier test worked when I set the dialect to "java". It
> does not work when it's set to "mvel".
>
> When the rule is written as follows :
>
> rule "Hello World"
> dialect "mvel"
>        when
>                $cur    : Message()
>                $others : ArrayList ( size > 0 ) from collect(Message(
> status ==
> Message.HELLO  ))
>        then
>                for ( int ctr = 0; ctr < $others.size(); ctr++ ) {
>                        System.out.println("Got message : " + (Message)
> others.get(i));
>                }
> end
>
> I am now getting the following error :
>
>    Unable to Analyse Expression for ( int ctr = 0; ctr < $others.size();
> ctr++ ) {
>                        System.out.println("Got message : " + (Message)
> others.get(i));
>                }               ;:
>    [Error: unable to resolve method using strict-mode:
> org.drools.spi.KnowledgeHelper.$others()]
>    [Near : {... int ctr = 0; ctr < $others.size(); ctr++ ) { ....}]
>                                ^
>    [Line: 7, Column: 0] : [Rule name='Hello World']
>
>    java.lang.IllegalArgumentException: Could not parse knowledge.
>        at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)
>        at com.sample.DroolsTest.main(DroolsTest.java:23)
>
> It looks like for some reason, the parser is unable to decipher the $other.
>
> Any insight into what could cause this ?
>
> Thanks in advance,
>
> Gurvinder
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList-tp3902766p3903052.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120411/91c21926/attachment.html 


More information about the rules-users mailing list