【问题标题】:Drools, Update error: handle not found for objectDrools,更新错误:找不到对象的句柄
【发布时间】:2015-08-21 21:12:59
【问题描述】:

这是我的规则

rule "ICodes in HISTORY" 
@filename("ORDERING.drl")
ruleflow-group "ORDERING_MAIN" 
lock-on-active true
salience 5000
when
    icodeColl:  ArrayList (size > 0) from collect ( CodeFact( traceSegments contains RuleConstant.Seg.H, position == null, type == RuleConstant.CodeSource.I) )

    ccodeColl:  ArrayList (size >= 0) from collect ( CodeFact( type == RuleConstant.CodeSource.C) )

    orderHier:  OrderHierarchy( identifier == 
            RuleConstant.ReferenceTables.IHIER)
    theCase:    CaseFact()
then
    ArrayList hOrderedIcodes= orderHier.order(icodeColl, ccodeColl);

    for (int i=0; i<hOrderedIcodes.size(); i++) {
        CodeFact icode = (CodeFact)hOrderedIcodes.get(i);
        int positionCount = theCase.getPositionCount();

        icode.setPosition( BigInteger.valueOf( positionCount ) );
        theCase.incrementPosition();

        update( icode);
    }
end

这是我得到的错误。我知道 CodeFact 在另一条规则中被撤回,但这对我来说太疯狂了,我会在 when 子句中吞噬它,但在 then 子句中它不可用于更新。

org.drools.FactException:更新错误:找不到对象的句柄: CodeFact@2a501b38 {xxx.xxx, 1, 1.0}。 它在工作记忆中吗?

【问题讨论】:

  • 可能是一个错误。创建一整套重现问题所需的 Java 和 DRL 文件,并将其全部添加到您的问题中,并确保提及 Drools 版本。

标签: drools


【解决方案1】:

对于仍然遇到此问题的任何人,11 个月后就像我一样: 我一直在使用 drools 处理一个稍旧的项目,我们总是使用 Java 7 运行它。在尝试使用 Java 8 运行我们的项目后出现此错误。希望这对某人有所帮助,因为我无法从谷歌搜索中找到直接的答案。这只是我遇到此错误的经验,希望这是您的原因!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 2022-01-08
    • 2015-06-12
    • 1970-01-01
    相关资源
    最近更新 更多