Drools - 使用 RuleNameEndsWithAgendaFilter 时出现 ClassCastException
这是我正在使用的代码片段:
AgendaFilter filter = (AgendaFilter) new RuleNameEndsWithAgendaFilter("Test");
// Gives a compile time error if I don't cast it.
// Run the rules
int numOfRulesFired = stateFulKnowledgeSession.fireAllRules(filter);
这会产生运行时异常:
java.lang.ClassCastException: org.drools.base.RuleNameEndsWithAgendaFilter cannot be cast to org.drools.runtime.rule.AgendaFilter
如果我在这里遗漏了某些内容,请告诉我。
谢谢, 阿什温
Here is the snippet of code that I'm using :
AgendaFilter filter = (AgendaFilter) new RuleNameEndsWithAgendaFilter("Test");
// Gives a compile time error if I don't cast it.
// Run the rules
int numOfRulesFired = stateFulKnowledgeSession.fireAllRules(filter);
This spits out a runtime Exception :
java.lang.ClassCastException: org.drools.base.RuleNameEndsWithAgendaFilter cannot be cast to org.drools.runtime.rule.AgendaFilter
Please let me know If I'm missing out something here.
Thanks,
Ashwin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
AgendaFilter
似乎有误。我检查了最新的 Drools 代码,org.drools.runtime.rule.AgendaFilter
不再存在,或者它被重命名为更好的名称。使用 org.drools.spi.AgendaFilter 就可以了。
Looks like you have the wrong
AgendaFilter
. I checked the latest Drools codes andorg.drools.runtime.rule.AgendaFilter
no longer exists or it is renamed to something better.Use
org.drools.spi.AgendaFilter
and it works.