What version of MVEL are you using? try updating to MVEL 1.3.9 in case you are not using it already. If you are already using 1.3.9, please let us know.

   []s
   Edson

2009/4/28 Zeke <xanadu860122@gmail.com>
Hi,
  I am using Drools 4.0.7 GA. I want to use Array type in my rule condition. My drl is like below:
  package org.drools.examples.test;
 
  import org.drools.examples.HelloWorldExample.Message;

  rule "check.array"
      dialect "java"
      when
          m:Message( arr[0] == "1" )
      then
          System.out.println( "===check array ok===" );
  end
 
  arr is an int type array. When I run the test case, I meet below exception:
Exception in thread "main" org.drools.RuntimeDroolsException: Exception executing predicate eval( arr[0] == "1" )
    at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
    at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
    at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
    at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
    at org.drools.reteoo.Rete.assertObject(Rete.java:175)
    at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
    at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
    at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
    at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
    at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
    at org.drools.examples.HelloWorldExample.main(HelloWorldExample.java:69)
Caused by: org.mvel.CompileException: illegal use of []: unknown type: [I
    at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionProperty(ReflectiveAccessorOptimizer.java:482)
    at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:274)
    at org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:110)
    at org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:186)
    at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
    at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
    at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
    at org.mvel.MVEL.executeExpression(MVEL.java:234)
    at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:45)
    at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209)
    ... 10 more
 
Can anyone kindly tell me how to use Array type in Drools? Thanks in advance!

- Zeke

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com