Drools的。如果按FactType设置字段,则为NullPointerException

时间:2014-01-22 15:30:10

标签: drools

我声明要通过.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).... 

0 个答案:

没有答案