Fixing a drools regression

I am in the process of merging two applications. These applications have a similar structure and similar dependencies.
However, one of the applications uses Drools 5.4.0.Final because it needs an accumulate function which does not work in earlier versions. The other application runs fine using 5.3.1.Final but fails when updating to 5.4.

Though the exception is masked by other errors inside the application, some digging revealed the following:

at java.lang.String.<init>(
at org.mvel2.util.ErrorUtil.rewriteIfNeeded(
at org.mvel2.compiler.ExpressionCompiler._compile(
at org.mvel2.compiler.ExpressionCompiler.compile(
at org.mvel2.MVEL.compileExpression(
at org.drools.base.mvel.MVELCompilationUnit.compile(
at org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(
at org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(
at org.drools.rule.constraint.MvelConstraint.evaluate(
at org.drools.rule.constraint.MvelConstraint.isAllowed(
at org.drools.reteoo.AlphaNode.assertObject(
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(
at org.drools.reteoo.AlphaNode.assertObject(
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(
at org.drools.reteoo.ObjectTypeNode.assertObject(
at org.drools.reteoo.EntryPointNode.assertObject(
at org.drools.common.NamedEntryPoint.insert(
at org.drools.common.NamedEntryPoint.insert(
at org.drools.common.AbstractWorkingMemory.insert(
at org.drools.common.AbstractWorkingMemory.insert(
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(
at org.drools.impl.StatelessKnowledgeSessionImpl.execute(

Not nice.
Some debugging shows that the problem in the following rule:
rule "Check estimate values"
        kb: Calculation(
            null == totalEstimateExVat || totalEstimateExVat <= 0 ||
            null == vatAmountEstimate || vatAmountEstimate < 0 ||
            Math.abs(totalEstimateExVat + vatAmountEstimate - totalEstimateWithVat) > .00001 )
        validationException.addException("Estimate values are incorrect." );

Apparently, something changes in the way the expressions are evaluated. While it is a good practice in Java to do an equality test with the constant on the left (it avoids accidental assignment when typing = instead of ==), it seems that this coding style is no longer valid in Drools 5.4. Reverting the tests fixed the problem.


  1. Mario Fusco says:

    Hi Joachim,

    thanks for having found this. I am a developer of the Drools team and I am starting to give a look at this issue just now.

    If you will find other bugs in the future it will be very helpful (and will allow as to react in a more responsive way) if you could file the bug in our issue tracking system:

    or at least send an email reporting the problem to our users mailing list:

    Thanks again,

  2. Mario Fusco says:

    I opened a ticket for this issue ( ) and already fixed it. The fix will be available in the 5.5.0.Beta1 that we will release (hopefully) at the end of this week.

    Thanks again for having reported this.

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen