Thank you Wolfgang,<br><br>your bug report is crystal clear as usual ;)<br>I&#39;ll try to reproduce and fix this asap.<br><br>Mario<br><br><div class="gmail_quote">On Thu, Jan 17, 2013 at 7:29 AM, Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The error occurs when the following rule fires ;-)<br>
<br>
rule &quot;error occurs&quot;<br>
   $fact1: Fact( $class: class )<br>
   $fact2: Fact( class == $class, this != $fact1 )<br>
   Field( $name: name, type == $class, modifiers == Modifier.PUBLIC )<br>
   Rule( dialect == &quot;mvel&quot;,<br>
            $rule: name<br>
            rightHandSide matches (&quot;.\\s*&quot; + $name + &quot;\\s*=\\s*\S+\\s*;&quot; ) );<br>
then<br>
   System.out.println( &quot;When rule &quot; + $rule + &quot; fires, an exception occurs&quot; );<br>
end<br>
<br>
In words:<br>
All the following conditions must be met:<br>
   * WM contains at least two facts of the same type<br>
   * there is a public field<br>
   * the rule&#39;s dialect is set to MVEL<br>
   * a rule&#39;s right hand side contains an assignment to the public field<br>
<br>
Occurs with versions 5.[2345].0<br>
<br>
-W<br>
<br>
<br>
On 16/01/2013, Chang Liu &lt;<a href="mailto:CLiu@deltadentalmi.com">CLiu@deltadentalmi.com</a>&gt; wrote:<br>
&gt; A rule to repro this situation:<br>
&gt;<br>
&gt; The rule:<br>
&gt; ...<br>
&gt; rule &quot;Assignment In Action Test&quot;<br>
&gt;     when<br>
&gt;       obj : Foo()<br>
&gt;     then<br>
&gt;       obj.x = 1;<br>
&gt;         System.out.println(&quot;Rule Fired!&quot;);<br>
&gt; end<br>
&gt; ...<br>
&gt;<br>
&gt; Definition of class Foo:<br>
&gt; public class Foo {<br>
&gt;       public int x;<br>
&gt;       public int getX() {<br>
&gt;               return x;<br>
&gt;       }<br>
&gt;       public void setX(int x) {<br>
&gt;               this.x = x;<br>
&gt;       }<br>
&gt; }<br>
&gt;<br>
&gt; Objects been inserted:<br>
&gt; Foo foo1 = new Foo();<br>
&gt; foo1.x = 0;<br>
&gt; Foo foo2 = new Foo();<br>
&gt; Foo2.x = 1000;<br>
&gt;<br>
&gt; Note that if only one Foo object is inserted, things work fine. If more than<br>
&gt; one Foo objects are inserted, we see this Exception:<br>
&gt;<br>
&gt; Exception executing consequence for rule &quot;Assignment In Action Test&quot; in<br>
&gt; com.sample: java.lang.RuntimeException: unable to access field<br>
&gt;       at<br>
&gt; org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)<br>
&gt;       at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1283)<br>
&gt;       at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1209)<br>
&gt;       at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1442)<br>
&gt;       at<br>
&gt; org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)<br>
&gt;       at<br>
&gt; org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)<br>
&gt;       at<br>
&gt; org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)<br>
&gt;       at<br>
&gt; com.sample.AssignmentInActionTestMain.main(AssignmentInActionTestMain.java:37)<br>
&gt; Caused by: java.lang.RuntimeException: unable to access field<br>
&gt;       at<br>
&gt; org.mvel2.optimizers.impl.refl.nodes.DynamicFieldAccessor.setValue(DynamicFieldAccessor.java:66)<br>
&gt;       at<br>
&gt; org.mvel2.optimizers.impl.refl.nodes.IndexedVariableAccessor.setValue(IndexedVariableAccessor.java:43)<br>
&gt;       at<br>
&gt; org.mvel2.compiler.CompiledAccExpression.setValue(CompiledAccExpression.java:59)<br>
&gt;       at<br>
&gt; org.mvel2.ast.DeepAssignmentNode.getReducedValueAccelerated(DeepAssignmentNode.java:92)<br>
&gt;       at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)<br>
&gt;       at<br>
&gt; org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:126)<br>
&gt;       at org.mvel2.MVEL.executeExpression(MVEL.java:930)<br>
&gt;       at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:101)<br>
&gt;       at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)<br>
&gt;       ... 6 more<br>
&gt; Caused by: java.lang.NullPointerException<br>
&gt;       at org.mvel2.DataConversion.convert(DataConversion.java:118)<br>
&gt;       at<br>
&gt; org.mvel2.optimizers.impl.refl.nodes.DynamicFieldAccessor.setValue(DynamicFieldAccessor.java:61)<br>
&gt;       ... 14 more<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
&gt; [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Wolfgang Laun<br>
&gt; Sent: Wednesday, January 16, 2013 10:35 AM<br>
&gt; To: Rules Users List<br>
&gt; Subject: Re: [rules-users] Exception executing consequence for rule xxx in<br>
&gt; yyy: java.lang.RuntimeException: unable to access field<br>
&gt;<br>
&gt; What&#39;s the type of $billingOutputRuleContext.retroPreviousBillAmount?<br>
&gt;<br>
&gt; On 16/01/2013, magaram &lt;<a href="mailto:magaram@deltadentalmi.com">magaram@deltadentalmi.com</a>&gt; wrote:<br>
&gt;&gt; The behavior stated seems very erratic as other similar rules are<br>
&gt;&gt; executing.<br>
&gt;&gt; Also note that the fields in the consequence have a visibility of public.<br>
&gt;&gt; Are there any known issues surrounding this?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://drools.46999.n3.nabble.com/Exception-executing-consequence-for-" target="_blank">http://drools.46999.n3.nabble.com/Exception-executing-consequence-for-</a><br>
&gt;&gt; rule-xxx-in-yyy-java-lang-RuntimeException-unable-to-access-field-tp40<br>
&gt;&gt; 21553p4021576.html Sent from the Drools: User forum mailing list<br>
&gt;&gt; archive at Nabble.com.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt; **********************************************************************<br>
&gt; CONFIDENTIALITY NOTICE: The information contained in this email is intended<br>
&gt; only for the person or entity to which it is addressed and may contain<br>
&gt; confidential and/or privileged material. If you are not the intended<br>
&gt; recipient, you are hereby notified that any unauthorized review, use,<br>
&gt; dissemination, distribution or copying of this communication is prohibited<br>
&gt; and may be subject to legal restriction or sanction. If you have received<br>
&gt; this email in error, please notify the sender immediately to arrange for<br>
&gt; return or destruction of the information and all copies. If you are the<br>
&gt; intended recipient but do not wish to receive communications through this<br>
&gt; medium, please advise the sender immediately. Thank you<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
</blockquote></div><br>