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