Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-486

Multiple ClassCastException-s when executing rules

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.2.0.Beta2
    • 6.0.1.Final
    • None
    • None
    • Hide

      Always reproducible on our rule set.
      Hard to reproduce on small rule set.
      Error is similar to that we had in Drools 5.5.

      Show
      Always reproducible on our rule set. Hard to reproduce on small rule set. Error is similar to that we had in Drools 5.5.

      When trying to migrate to Drools 6.0.1 (everything was fine with 6.0.0) we get multiple ClassCastException.
      Assume we have hierarchy where B and C are children of A and we have following rules:
      when:
      B(....)
      then:
      ...

      when:
      C(...)
      then:
      ...

      Then following exceptions are observed on every execute with instance of B() in context:

      java.lang.ClassCastException: B cannot be cast to C
      at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:217)
      at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:174)
      at org.drools.core.phreak.PhreakFromNode.checkConstraintsAndPropagate(PhreakFromNode.java:298)
      at org.drools.core.phreak.PhreakFromNode.doLeftInserts(PhreakFromNode.java:101)
      at org.drools.core.phreak.PhreakFromNode.doNode(PhreakFromNode.java:49)
      at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:348)
      at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
      at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
      at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:200)
      at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:67)
      at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:935)
      at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1200)
      at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:957)
      at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:941)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:264)

      Again, everything works OK in Drools 6.0.0.

              mfusco@redhat.com Mario Fusco
              sergeya_jira Sergey Alaev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: