Hi,

   Mark just told me there is a problem with MVEL calling functions... I believe he is working on that...

    []s
    Edson


2007/8/29, hypnosat7 < ablarbi@yahoo.fr>:

I still have the same problem :

* (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(...)
package validity :false
org.drools.rule.InvalidRulePackage: Unable to build expression for
'consequence' '
                drools.rule.dialect="java"
                System.out.println(drools.getRule().getDialect());
                System.out.println("ok"+func());


' : [Rule name=Your First Rule, agendaGroup=MAIN, salience=0, no-loop=false]

        at org.drools.rule.Package.checkValidity(Package.java:416)
        at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:292)
        at mcmipih.rules.demo.service.TestDraft.main(TestDraft.java :34)


my rule :

rule "Your First Rule"
        dialect "mvel"
        when
                eval(true)
        then

                drools.rule.dialect="java"
                System.out.println(drools.getRule().getDialect());
                System.out.println("ok"+func());


end



Edson Tirelli-3 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
>
>     []s
>     Edson
>
> 2007/8/29, hypnosat7 <ablarbi@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.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> 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
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>

--
View this message in context: http://www.nabble.com/function-call-tf4346267.html#a12386450
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
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