unable to resolve method using strict-mode

1,838 views
Skip to first unread message

Alain Tanguay

unread,
May 5, 2015, 2:51:14 PM5/5/15
to drools...@googlegroups.com
Hi!

I'm newbie with java and drools and I have to build a java RESTful Web Services / rules engine.  We already have Genesys Rule Authoring (GRAT) and Genesys Rule Engine (GRE) (version 8.1.2) who run drools version 5.2.  We have the need to take the source of GRAT packages and use them in a "lite rule engine" for our development environments.  For my POC, I have install drools 5.2 and create a project who can digest my package and fire rules just like I want.  But for some package I have this kind of error : 

BuildError: Unable to Analyse Expression $routingparams.priority = obtenirValeurParametre($routingparams.priority,"100");
 $routingparams.target1 = obtenirValeurParametre($routingparams.target1, "AVGRP_GPAP_AEP_TA_MDP_E");:
[Error: unable to resolve method using strict-mode: com.desjardins.gtd.dpsccc.routage.gpap.routingparams.ObtenirValeurParametre.obtenirValeurParametre(java.lang.Integer, java.lang.String)]
[Near : {... ngparams.priority = obtenirValeurParametre($routin ....}]


If you look at .drl attach file, you'll see that the function obtenirValeurParametre(String, String).  You'll also see this function call with (Integer, String) and the error is on this line.  In drools package I can't have the same function with different params.  I have try to use "drools.dialect.mvel.strict" = false, but it doesn't change anything.
 
KnowledgeBuilderConfiguration kbConfig =KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbConfig
.setProperty("drools.dialect.mvel.strict", "false");
System.setProperty("drools.dialect.mvel.strict", "false");
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder( kbConfig );


As GRE run drools 5.2 like me and it work for GRE, I think that it must exist a solution other then add .toString() or something like this.  Considering that we have a lot of package and some of them have thousand of rules, I don't want to make adjustments on each rule.

Someone have an idea to solve that issues?  He/She will be my hero! 

Thanks

Alain
RoutingParamLite.drl

Davide Sottara

unread,
May 5, 2015, 4:43:32 PM5/5/15
to drools...@googlegroups.com
5.2 is a very old version.
Because of the way "functions" are handled in a rule consequence, some parsing/rewriting is needed.
In your case, it seems to be ignoring the comment "//"
Can you try removing the line altogether, or creating a mock function(Integer,String) and see what happens?

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/07600fb5-e4d8-42f5-8ba1-d810ad2d3769%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alain Tanguay

unread,
May 6, 2015, 9:35:48 AM5/6/15
to drools...@googlegroups.com
I realize that the attach file is the wrong version of my .drl file.  With "//$routingparams.priority = obtenirValeurParametre($routingparams.priority,'100')", I dont have the error and it's normal, but don't make the job.  The error appear when this line is active, like this : 
rule "Row 1 DT-6249 UNIT_Test Alain"
salience 99000 
agenda-group "level1"
dialect "mvel"
when
ContexteInteraction( destination == 'GPAP_AEP_TA_MDP')
$routingparams:RoutingParams(); 
$contexteInteraction:ContexteInteraction();
then

$routingparams.priority = obtenirValeurParametre($routingparams.priority,'100')
$routingparams.target1 = obtenirValeurParametre($routingparams.target1, 'AVGRP_GPAP_AEP_TA_MDP_E')
end

Someone give me a solution here
Reply all
Reply to author
Forward
0 new messages