DefaultKnowledgeHelper unable to resolve method in JBoss BRMS

Solution Verified - Updated -

Issue

  • A method in the model JAR not being resolved by the KnowledgeAgent during runtime.
  • Interestingly, validation of the rule passes from inside the Guvnor interface, so it appears it is able to resolve the method there.
  • The DRL definition is similar to:
...
java.math.BigDecimal $val_1 = CustomClass.someMethod1(someval);
java.math.BigDecimal $val_2 = CustomClass.someMethod2(someval);
...
  • The error message produced in the logs is as follows:
Exception in thread "main" Exception executing consequence for rule "XYZ" in **.rules: [Error: unable to resolve method: org.drools.base.DefaultKnowledgeHelper.someMethod2(java.math.BigDecimal) [arglength=1]]
[Near : {... *** ....}]
             ^
[Line: 1, Column: 1]
    at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
    at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1201)
    at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1126)
    at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1349)
    at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:709)
    at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
    at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:228)
    at aaa.bbb.ccc.main(FrondeRuleAgentTest.java:143)
Caused by: [Error: unable to resolve method: org.drools.base.DefaultKnowledgeHelper.someMethod2(java.math.BigDecimal) [arglength=1]]
[Near : {... *** ....}]
             ^
[Line: 1, Column: 1]
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1079)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1071)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:987)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:377)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143)
    at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
    at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
    at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
    at org.mvel2.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:70)
    at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
    at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
    at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:116)
    at org.mvel2.MVEL.executeExpression(MVEL.java:930)
    at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:101)
    at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1191)
    ... 6 more

Environment

  • JBoss Enterprise Business Rules Management System Platform (BRMS)
    • 5.3.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