[rules-users] could not access property ('=')

Edson Tirelli tirelli at post.com
Mon Aug 13 12:45:57 EDT 2007


   This looks like an MVEL issue, since your expression is being converted
into an MVEL predicate. May I ask you please to open a JIRA for that bug?

   Meanwhile, a workaround that shall work for you and may give you improved
perf is to split your pattern into 2 patterns using the from keyword:


when

           $dto : DTO( )

           W250_4_1( value *in* ("0","1","6","7","A","C","D","G","L","M","P"
,"Q","S","V","Z") ) from $dto.w250_4_1

then

   Thanks, and hope it helps.

   Edson


2007/8/13, Arsalan S. Zaidi <arsalan.zaidi at capgemini.com>:
>
>  Hi.
>
>
>
> I've currently evaluating Drools 4.0 for a project of ours and I'm running
> into some problems.
>
>
>
> I have a rule which looks like this:
>
>
>
> *rule* "W250.42 Editable"
>
>       *when*
>
>             DTO(w250_4_1.value *in* ("0","1","6","7","A","C","D","G","L",
> "M","P","Q","S","V","Z") )
>
>       *then*
>
>             System.out.println ("0");
>
>             Action action = createAction("W250.42", *false*, *true*);
>
>             retList.add(action);
>
> *end*
>
>
>
>
>
> both DTO and w250_4_1 are extremely simple beans. w250_4_1 just has 1
> property 'value' which is a String and DTO has one property w250_4_1 which
> is the bean w250_4_1.
>
>
>
> Now when I put "0" into w250_4_1 then everything works fine. The rule is
> true and the 'then' portion is executed. However, if I set w250_4_1 to "6"
> (which is also present in the in (…)) then I get the following error.
>
>
>
> *org.drools.RuntimeDroolsException*: Exception executing predicate
> org.drools.base.mvel.MVELPredicateExpression at 118fa47
>
>       at org.drools.rule.PredicateConstraint.isAllowed(*
> PredicateConstraint.java:197*)
>
>       at org.drools.reteoo.AlphaNode.assertObject(*AlphaNode.java:122*)
>
>       at
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(*
> CompositeObjectSinkAdapter.java:317*)
>
>       at org.drools.reteoo.ObjectTypeNode.assertObject(*
> ObjectTypeNode.java:168*)
>
>       at org.drools.reteoo.Rete.assertObject(*Rete.java:168*)
>
>       at org.drools.reteoo.ReteooRuleBase.assertObject(*
> ReteooRuleBase.java:190*)
>
>       at org.drools.reteoo.ReteooWorkingMemory.doInsert(*
> ReteooWorkingMemory.java:70*)
>
>       at org.drools.common.AbstractWorkingMemory.insert(*
> AbstractWorkingMemory.java:848*)
>
>       at org.drools.common.AbstractWorkingMemory.insert(*
> AbstractWorkingMemory.java:822*)
>
>       at org.drools.common.AbstractWorkingMemory.insert(*
> AbstractWorkingMemory.java:623*)
>
>       at com.sample.DroolsTest.main(*DroolsTest.java:34*)
>
> Caused by: *org.mvel.PropertyAccessException*: failed to access property:
> <<==>> in: class com.sample.DTOShadowProxy
>
>       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.ast.Or.getReducedValueAccelerated(*Or.java:18*)
>
>       at org.mvel.MVELRuntime.execute(*MVELRuntime.java:87*)
>
>       at org.mvel.CompiledExpression.getValue(*CompiledExpression.java:98*
> )
>
>       at org.mvel.MVEL.executeExpression(*MVEL.java:202*)
>
>       at org.drools.base.mvel.MVELPredicateExpression.evaluate(*
> MVELPredicateExpression.java:36*)
>
>       at org.drools.rule.PredicateConstraint.isAllowed(*
> PredicateConstraint.java:191*)
>
>       ... 10 more
>
> Caused by: *org.mvel.PropertyAccessException*: could not access property
> ('=')
>
>       at
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(
> *ReflectiveAccessorOptimizer.java:252*)
>
>       at
> org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(
> *ReflectiveAccessorOptimizer.java:106*)
>
>       ... 18 more
>
>
>
> If I keep w250_4_1 as "0", but move "0" in the rule to any other place
> place in the in() list (e.g. in ("1","0",…), then I get a similar error.
>
>
>
> I get similar errors when trying to use 'not in' in the same circumstance,
> except that then the property is ('!')
>
>
>
> What seems to be the issue?
>
>
>
> Thanks in advance!
>
>
>
> Regards,
>
>
>
> --Arsalan
>  This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient, you
> are not authorized to read, print, retain, copy, disseminate, distribute, or
> use this message or any part thereof. If you receive this message in error,
> please notify the sender immediately and delete all copies of this message.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070813/805a2d3e/attachment.html 


More information about the rules-users mailing list