This is a different problem now, see droolsjbpm-introduction-docs on "strict mode". It says that you can configure<div> drools.dialect.mvel.strict = false</div><div>to avoid such problems.</div><div><br></div>
<div>-W</div><div><br><br><div class="gmail_quote">On 11 April 2012 18:27, groovenarula <span dir="ltr"><<a href="mailto:gnarula1@la-z-boy.com">gnarula1@la-z-boy.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
laune,<br>
<br>
Unfortunately, the earlier test worked when I set the dialect to "java". It<br>
does not work when it's set to "mvel".<br>
<br>
When the rule is written as follows :<br>
<br>
rule "Hello World"<br>
dialect "mvel"<br>
when<br>
$cur : Message()<br>
$others : ArrayList ( size > 0 ) from collect(Message( status ==<br>
Message.HELLO ))<br>
then<br>
for ( int ctr = 0; ctr < $others.size(); ctr++ ) {<br>
System.out.println("Got message : " + (Message) others.get(i));<br>
}<br>
end<br>
<br>
I am now getting the following error :<br>
<br>
Unable to Analyse Expression for ( int ctr = 0; ctr < $others.size();<br>
ctr++ ) {<br>
System.out.println("Got message : " + (Message) others.get(i));<br>
} ;:<br>
[Error: unable to resolve method using strict-mode:<br>
org.drools.spi.KnowledgeHelper.$others()]<br>
[Near : {... int ctr = 0; ctr < $others.size(); ctr++ ) { ....}]<br>
^<br>
[Line: 7, Column: 0] : [Rule name='Hello World']<br>
<br>
java.lang.IllegalArgumentException: Could not parse knowledge.<br>
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)<br>
at com.sample.DroolsTest.main(DroolsTest.java:23)<br>
<br>
It looks like for some reason, the parser is unable to decipher the $other.<br>
<br>
Any insight into what could cause this ?<br>
<br>
Thanks in advance,<br>
<br>
Gurvinder<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList-tp3902766p3903052.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList-tp3902766p3903052.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>