[rules-users] function call
Mark Proctor
mproctor at codehaus.org
Wed Aug 29 09:23:26 EDT 2007
unfortunately not, due to the build life cycle and classpath issues mvel
cannot call functions defined in the DRL, although it can call normal
static methods of existing classes ok.
Mark
Edson Tirelli wrote:
>
> I believe this problem is already fixed in trunk. You can download
> latest build from here:
>
> http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules
> <http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules>
>
> []s
> Edson
>
> 2007/8/29, hypnosat7 <ablarbi at yahoo.fr <mailto:ablarbi at yahoo.fr>>:
>
>
> I try and change the dialect but it doesn't work
>
> rule "Your First Rule"
> dialect "mvel"
> when
>
> then
>
> drools.rule.dialect="java"
> System.out.println(drools.getRule().getDialect());
> System.out.println("ok"+func());
>
>
> end
>
> the package still invalid :
> * (1,6) unable to resolve method using strict-mode:
> java.lang.Object.func(...)
> * (1,6) unable to resolve method using strict-mode:
> java.lang.Object.func(...)
>
>
>
> hypnosat7 wrote:
> >
> > Hi,
> >
> > I have a simple rule :
> >
> > function String isTrue() {
> > return "true";
> > }
> >
> > rule "new rule"
> > dialect "mvel"
> > when
> > eval(true)
> > then
> > System.out.println ("passe"+isTrue());
> > end
> >
> > But it seems impossible to call function's :
> >
> > org.mvel.PropertyAccessException: failed to access property:
> > <<System.out.println("passe"+isTrue())>> in: null
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:137)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor
> (ReflectiveAccessorOptimizer.java:96)
> > at
> org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:194)
> > at org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
> > at org.mvel.MVEL.executeDebugger (MVEL.java:327)
> > at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:43)
> > at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:545)
> > at org.drools.common.DefaultAgenda.fireNextItem
> (DefaultAgenda.java:509)
> > at
> >
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430)
> > at
> >
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java
> :392)
> > at
> mcmipih.rules.demo.service.TestDraft.main(TestDraft.java:37)
> > Caused by: org.mvel.PropertyAccessException: null pointer
> exception in
> > property: isTrue()
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain
> (ReflectiveAccessorOptimizer.java:143)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:96)
> > at org.mvel.ASTNode.getReducedValueAccelerated
> (ASTNode.java:194)
> > at
> >
> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:20)
> > at org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
> > at org.mvel.CompiledExpression.getValue
> (CompiledExpression.java:98)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:421)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain
> (ReflectiveAccessorOptimizer.java:109)
> > ... 10 more
> > Caused by: java.lang.NullPointerException
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java
> :429)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:109)
> > ... 17 more
> > org.drools.spi.ConsequenceException:
> org.mvel.PropertyAccessException :
> > failed to access property:
> <<System.out.println("passe"+isTrue())>> in:
> > null
> > at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:549)
> > at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509)
> > at
> >
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430)
> > at
> > org.drools.common.AbstractWorkingMemory.fireAllRules
> (AbstractWorkingMemory.java:392)
> > at
> mcmipih.rules.demo.service.TestDraft.main(TestDraft.java:37)
> > Caused by: org.mvel.PropertyAccessException: failed to access
> property:
> > <<System.out.println ("passe"+isTrue())>> in: null
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:137)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor
> (ReflectiveAccessorOptimizer.java:96)
> > at
> org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:194)
> > at org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
> > at org.mvel.MVEL.executeDebugger (MVEL.java:327)
> > at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:43)
> > at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:545)
> > ... 4 more
> > Caused by: org.mvel.PropertyAccessException: null pointer
> exception in
> > property: isTrue()
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:143)
>
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:96)
> > at
> org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:194)
> > at
> >
> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:20)
> > at org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
> > at
> org.mvel.CompiledExpression.getValue(CompiledExpression.java :98)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:421)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain
> (ReflectiveAccessorOptimizer.java:109)
> > ... 10 more
> > Caused by: java.lang.NullPointerException
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java
> :429)
> > at
> >
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:109)
> > ... 17 more
> >
>
> --
> View this message in context:
> http://www.nabble.com/function-call-tf4346267.html#a12383032
> Sent from the drools - user mailing list archive at Nabble.com
> <http://Nabble.com>.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @ www.jboss.com <http://www.jboss.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070829/a0034b3c/attachment.html
More information about the rules-users
mailing list