Hi.
I’ve currently evaluating Drools 4.0 for a project of
ours and I’m running into some problems.
I have a rule which looks like this:
rule "W250.42
Editable"
when
DTO(w250_4_1.value
in ("0","1","6","7","A","C","D","G","L","M","P","Q","S","V","Z") )
then
System.out.println
("0");
Action
action = createAction("W250.42", false, true);
retList.add(action);
end
both DTO and w250_4_1 are extremely simple beans. w250_4_1 just has 1 property ’value’
which is a String and DTO has one property w250_4_1 which is the bean w250_4_1.
Now when I put “0” into w250_4_1 then everything works fine. The
rule is true and the ‘then’ portion is executed. However, if I set w250_4_1 to “6” (which is also
present in the in (…)) then I get the following error.
org.drools.RuntimeDroolsException: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression@118fa47
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:197)
at
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:122)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:317)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168)
at
org.drools.reteoo.Rete.assertObject(Rete.java:168)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:848)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:822)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:623)
at com.sample.DroolsTest.main(DroolsTest.java:34)
Caused by: org.mvel.PropertyAccessException: failed to access property: <<==>> in: class
com.sample.DTOShadowProxy
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:137)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:96)
at
org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:194)
at
org.mvel.ast.Or.getReducedValueAccelerated(Or.java:18)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:98)
at org.mvel.MVEL.executeExpression(MVEL.java:202)
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:191)
... 10 more
Caused by: org.mvel.PropertyAccessException: could not access property ('=')
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:252)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:106)
... 18 more
If I keep w250_4_1 as “0”, but move “0”
in the rule to any other place place in the in() list (e.g. in (“1”,”0”,…),
then I get a similar error.
I get similar errors when trying to use ‘not in’
in the same circumstance, except that then the property is (‘!’)
What seems to be the issue?
Thanks in advance!
Regards,
--Arsalan