Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
Description
Following exception occurs when trying to execute modify command on stateful
session:
{ with (this)
{ age = 30 ,name = Frank ,id = 0 ,likes = nobody } }Exception in thread "main" [Error: unable to resolve method:
com.redhat.modifyreproducer.Person.Frank() [arglength=0]]
[Near :
]
^
[Line: 5, Column: 1]
at org.mvel2.PropertyAccessor.getMethod(PropertyAccessor.java:977)
at org.mvel2.PropertyAccessor.getBeanProperty(PropertyAccessor.java:687)
at org.mvel2.PropertyAccessor.getNormal(PropertyAccessor.java:202)
at org.mvel2.PropertyAccessor.get(PropertyAccessor.java:171)
at org.mvel2.PropertyAccessor.get(PropertyAccessor.java:151)
at org.mvel2.ast.ASTNode.getReducedValue(ASTNode.java:185)
at
org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106)
at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49)
at org.mvel2.MVEL.eval(MVEL.java:408)
at org.mvel2.util.ParseTools.parseWithExpressions(ParseTools.java:1591)
at org.mvel2.ast.WithNode.getReducedValue(WithNode.java:75)
at
org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106)
at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49)
at org.mvel2.MVEL.eval(MVEL.java:109)
at
org.drools.command.runtime.rule.ModifyCommand.execute(ModifyCommand.java:79)
at
org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:798)
at
org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:781)
at com.redhat.modifyreproducer.Main.test(Main.java:52)
at com.redhat.modifyreproducer.Main.main(Main.java:30)
------------------------------------------------------------------------------
First, fact is inserted into the session, next step is creating Modify command
with setter list:
Person p1 = new Person("John", "nobody", 25);
session.execute(CommandFactory.newInsert(p1));
FactHandle fh = session.getFactHandle(p1);
Person p = new Person("Frank", "nobody", 30);
List<Setter> setterList = new ArrayList<Setter>();
setterList.add(CommandFactory.newSetter("age",
String.valueOf(p.getAge())));
setterList.add(CommandFactory.newSetter("name", p.getName()));
setterList.add(CommandFactory.newSetter("likes", p.getLikes()));
setterList.add(CommandFactory.newSetter("id",
String.valueOf(p.getId())));
session.execute(CommandFactory.newModify(fh, setterList));
See an attachment for the details, just build as maven project and run.