Hi,
with Drools 4.0.4 and MVEL 1.4, simple RHS like this one fail for me:
---
package test;
dialect "mvel"
rule "Rule #1"
when
then
System.out.println("now computing 1+1...");
Integer two = new Integer(2);
System.out.println(two);
end
---
now computing 1+1...
org.mvel.CompileException: unable to resolve property: two
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:288)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:109)
at
org.mvel.ast.ContextDeepPropertyNode.getReducedValueAccelerated(ContextDeepPropertyNode.java:26)
at org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:123)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:26)
at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:521)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:260)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:109)
at
org.mvel.ast.LiteralDeepPropertyNode.getReducedValueAccelerated(LiteralDeepPropertyNode.java:28)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:471)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)
at org.libx.autodetect.DroolsDriver$Host.fireAllRules(DroolsDriver.java:63)
at org.libx.autodetect.DroolsDriver.main(DroolsDriver.java:136)
Caused by: org.mvel.PropertyAccessException: unable to resolve property: two
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:382)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:257)
... 19 more
org.mvel.CompileException: unable to resolve token: two
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:297)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:109)
at
org.mvel.ast.LiteralDeepPropertyNode.getReducedValueAccelerated(LiteralDeepPropertyNode.java:28)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:471)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)
at org.libx.autodetect.DroolsDriver$Host.fireAllRules(DroolsDriver.java:63)
at org.libx.autodetect.DroolsDriver.main(DroolsDriver.java:136)
Caused by: org.mvel.UnresolveablePropertyException: unable to resolve token: two
at org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:127)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:26)
at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:521)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:260)
... 12 more
Caused by: org.mvel.CompileException: unable to resolve property: two
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:288)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:109)
at
org.mvel.ast.ContextDeepPropertyNode.getReducedValueAccelerated(ContextDeepPropertyNode.java:26)
at org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:123)
... 16 more
Caused by: org.mvel.PropertyAccessException: unable to resolve property: two
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:382)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:257)
... 19 more
etc.
It appears to be related to the use of MVEL - the same rule with
'dialect "java"' executes correctly.
- Godmar