我声明要通过.drl语法插入元素:
declare TheElement
myfield:long
end
我尝试在我的javacode中设置字段:
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)....