Drools 流口水。如果按FactType设置字段,则为NullPointerException

Drools 流口水。如果按FactType设置字段,则为NullPointerException,drools,Drools,我通过.drl语法声明了要插入的元素: declare TheElement myfield:long end 我尝试在我的Java代码中设置字段: FactType type = base.getFactType(PACKAGE, "TheElement"); Object myObj = type.newInstance(); type.set(myObj , "myfield", 226); //if I comment this line the insert is ok but

我通过.drl语法声明了要插入的元素:

declare TheElement
  myfield:long
end
我尝试在我的Java代码中设置字段:

FactType type = base.getFactType(PACKAGE, "TheElement");
Object myObj = type.newInstance();
type.set(myObj , "myfield", 226); //if I comment this line the insert is ok but the     field was not set
handle = session.insert(myObj);

session.fireAllRules();
我收到这个错误:

Exception in thread "main" java.lang.NullPointerException
at org.drools.factmodel.ClassDefinition.set(ClassDefinition.java:232)
at org.rec.Session.notify(Session.java:124).... 

适用于我的5.3.0、5.4.0、5.5.0I通过在$las:LeftArmStretch时使用rule:rule set timestamp设置myField来解决问题;然后System.out.println//timestamp更改!!;$las.setTimeclock.getCurrentTime;终止