Translated message

A translation of this page exists in English.

BRMS でしばらくの間ルールを実行していると ClassCastException が発生する

Solution Unverified - Updated -

Issue

  • しばらくの間ルールを実行すると ClassCastException が発生します。
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal
    at ConditionEvaluator96bc4b8b5b1e4ac8ade8d7dc9012e0c6.evaluate(Unknown Source)
    at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:248)
    at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:204)
    at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
    at org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:494)
    at org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:384)
    at org.drools.core.reteoo.ObjectTypeNode.propagateAssert(ObjectTypeNode.java:298)
    at org.drools.core.phreak.PropagationEntry$Insert.execute(PropagationEntry.java:93)
    at org.drools.reteoo.common.RetePropagationList.addEntry(RetePropagationList.java:36)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.addPropagation(StatefulKnowledgeSessionImpl.java:1989)
    at org.drools.reteoo.common.ReteWorkingMemory.addPropagation(ReteWorkingMemory.java:229)
    at org.drools.core.reteoo.EntryPointNode.assertObject(EntryPointNode.java:224)
    at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:277)
    at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:237)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1465)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1420)

ルール条件が、互換性のないクラスの引数でメソッドを呼び出しています。しばらく実行している場合に限りこの問題が発生しているのはなぜですか?

when
  $model :Model($model.isZero($model.getIntegerValue()))
then
  ...
public class Model {
    private Integer integerValue;
    public Integer getIntegerValue() {
        return integerValue;
    }
    public void setIntegerValue(Integer integerValue) {
        this.integerValue = integerValue;
    }
    public static boolean isZero(BigDecimal value) {
        if (value.compareTo(BigDecimal.ZERO) == 0) {
            return true;
        }
        return false;
    }
}

Environment

  • Red Hat JBoss BRMS
    • 6.0.3
    • 6.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content