[rules-users] Importing multiple functions from helper in MVEL dialect

Travis_Smith at bnz.co.nz Travis_Smith at bnz.co.nz
Wed Feb 16 22:12:58 EST 2011


Hi folks,

>From the "Should I be loading a JIRA or have I just mucked up?" files:

The following import line makes all of the functions in that class 
available from ctrl-space for rules marked with both Mvel and Java (and 
not specified) dialects

import function bnz.btt.mylend.common.model.utils.DecisionHelper.*;

It compiles fine, and runs fine from any class _not_ marked as dialect 
"mvel"

However when I actually execute any of those functions from a rule marked 
with dialect "mvel" the following occurs:

(In this example I'm calling from the DecisionHelper the static method 
createSystemCreditDecisionReason)
___________________________________

org.drools.runtime.rule.ConsequenceException: rule: CAP 06 Rule

        at 
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(
DefaultConsequenceExceptionHandler.java:23)
        at org.drools.common.DefaultAgenda.fireActivation(
DefaultAgenda.java:981)
        at org.drools.common.DefaultAgenda.fireNextItem(
DefaultAgenda.java:918)
        at org.drools.common.DefaultAgenda.fireAllRules(
DefaultAgenda.java:1130)
        at org.drools.common.AbstractWorkingMemory.fireAllRules(
AbstractWorkingMemory.java:740)
        at org.drools.common.AbstractWorkingMemory.fireAllRules(
AbstractWorkingMemory.java:706)
        at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(
StatefulKnowledgeSessionImpl.java:200)
        at bnz.btt.mylend.rules.test.MyLendingRulesTest.main(
MyLendingRulesTest.java:83)
Caused by: [Error: unable to access property (null parent): 
createSystemCreditDecisionReason]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
        at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(
ReflectiveAccessorOptimizer.java:886)
        at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(
ReflectiveAccessorOptimizer.java:314)
        at 
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(
ReflectiveAccessorOptimizer.java:137)
        at org.mvel2.ast.ASTNode.getReducedValueAccelerated(
ASTNode.java:137)
        at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
        at org.mvel2.compiler.CompiledExpression.getValue(
CompiledExpression.java:104)
        at org.mvel2.MVEL.executeExpression(MVEL.java:1001)
        at org.drools.base.mvel.MVELConsequence.evaluate(
MVELConsequence.java:87)
        at org.drools.common.DefaultAgenda.fireActivation(
DefaultAgenda.java:972)
        ... 6 more
___________________________________


There is a work-around: If I import each function separately it works just 
fine, eg:
___________________________________

import function 
bnz.btt.mylend.common.model.utils.DecisionHelper.createSystemCreditDecisionReason;
___________________________________

But as far as I can tell the ".*" notation to import all functions from a 
class SHOULD work.


So: Should I JIRA this, or have I just done something wrong?

Thanks!

Travis Smith
Analyst Programmer
Development Centre
BNZ

DDI: +644 4746356 (Or Ext 76356)

CAUTION - This message may contain privileged and confidential information 
intended only for the use of the addressee named above. If you are not the 
intended recipient of this message you are hereby notified that any use, 
dissemination, distribution or reproduction of this message is prohibited. 
This email was sent by the Bank of New Zealand. You can contact us on 
0800 ASK BNZ (0800 275 269). Any views expressed in this message are those 
of the individual sender and may not necessarily reflect the views of Bank 
of New Zealand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110217/06303148/attachment.html 


More information about the rules-users mailing list