Hi All,

 

 

 I am using Drools 4.0.7 and when I tried to use “matches” operator it is giving following  exception

The rule logic is following

 

package com.logica.heca.lpr.rule;

import com.logica.heca.lpr.domain.*;

import com.logica.heca.lpr.domain.contact.*;

import com.logica.heca.lpr.domain.ruleengine.*;

import java.util.*;

rule    "CPR_RULE_222222"

dialect "mvel"

when

   INDUD : ContactVO();

   eval(INDUD.districtCode matches "((UX)[ACMR][[A-Z0-9]]{3})|([A-Z0-9]++)")

   then

 

       System.out.println("hello");

End

 

Note: INDUD.districtCode returns String value.

 

While  if I changed matches operator to java method this work fine

eval(INDUD.getDistrictCode().matches("((UX)[ACMR][[A-Z0-9]]{3})|([A-Z0-9]++)"));

 

any of your esteemed help will highly be appreciated

 

Thanks

Ravendra Kumar

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

org.drools.RuntimeDroolsException: org.drools.base.mvel.MVELEvalExpression@1cf7491 : java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean

                at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:82)

                at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:148)

                at org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)

                at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)

                at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)

                at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)

                at org.drools.reteoo.Rete.assertObject(Rete.java:175)

                at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)

                at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)

                at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)

                at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)

                at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)

                at org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:143)

                at com.logica.heca.lpr.rule.RuleTester.main(RuleTester.java:44)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean

                at org.drools.base.mvel.MVELEvalExpression.evaluate(MVELEvalExpression.java:42)

                at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:77)

                ... 18 more

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Thanks and Regards,

 

Ravendra kumar

IT Consultant

__________________________________
Logica
- Releasing your potential

 

Margrethepladsen 4, 8000 Århus C
Danmark
T: +45 2518 8864
E-mail: ravendra.kumar@logica.com
www.logica.dk

 


Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.