[rules-dev] [Bug] cannot invoke method: asList

Mario Fusco mario.fusco at gmail.com
Tue Jan 22 09:59:25 EST 2013


Wolfgang,

in the end I found that this issue and the one you reported last week were
not related.
Anyway I fixed both, but as usual the fixes will be available when I'll
deploy the next mvel release.

Thanks again for your help,
Mario

On Tue, Jan 22, 2013 at 12:24 PM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:

> Below is a self-contained DRL which, when run with 5.5.0,  throws an
> exception "cannot invoke method asList". Remarkably, this only happens
> when a second Project fact is inserted. (Haven't I heard this before?)
>
> -W
>
> import java.util.List;
> import java.util.Arrays;
> import java.util.ArrayList;
>
> declare Project
> @typesafe (false)
>         list1 : List
>         list2 : List
> end
>
> rule kickoff
> salience 999999
> when
> then
>     insert( new Project() );
>     insert( new Project() );   // necessary to trigger the exception
> end
>
> rule " Config rule "
> dialect "mvel"
> no-loop true
> when
>     P : Project()
> then
>     modify(P) {
>        list1 = Arrays.asList(10, 15, 20, 25),
>        list2 = Arrays.asList(11, 2, 3, 4, 5, 10, 9, 8, 7)
>     };
> end
>
> Exception in thread "main" Exception executing consequence for rule "
> Config rule " in express: java.lang.RuntimeException: cannot construct
> object
>         at
> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
>         at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1297)
>         at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
>         at
> org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456)
>         at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
>         at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
>         at
> org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
>         at express.Main.execute(Main.java:77)
>         at express.Main.main(Main.java:110)
> Caused by: java.lang.RuntimeException: cannot construct object
>         at
> org.mvel2.optimizers.impl.refl.nodes.ConstructorAccessor.getValue(ConstructorAccessor.java:63)
>         at
> org.mvel2.ast.NewObjectNode.getReducedValueAccelerated(NewObjectNode.java:233)
>         at
> org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
>         at org.mvel2.ast.WithNode$ParmValuePair.eval(WithNode.java:281)
>         at
> org.mvel2.ast.WithNode.getReducedValueAccelerated(WithNode.java:67)
>         at
> org.mvel2.ast.InterceptorWrapper.getReducedValueAccelerated(InterceptorWrapper.java:40)
>         at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
>         at
> org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
>         at
> org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
>         at org.mvel2.MVEL.executeExpression(MVEL.java:930)
>         at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:104)
>         at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
>         ... 7 more
> Caused by: java.lang.RuntimeException: cannot invoke method: asList
>         at
> org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:63)
>         at
> org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
>         at
> org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
>         at
> org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
>         at
> org.mvel2.optimizers.impl.refl.nodes.ConstructorAccessor.executeAll(ConstructorAccessor.java:76)
>         at
> org.mvel2.optimizers.impl.refl.nodes.ConstructorAccessor.getValue(ConstructorAccessor.java:43)
>         ... 18 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
>         at
> org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:149)
>         at
> org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48)
>         ... 23 more
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20130122/df970591/attachment.html 


More information about the rules-dev mailing list