<br> DRL rule is case sensitive, so you should write, according to the javabean spec:<br><br><font size="2"> v : validaciones(cantSegundos == 0)
</font><br> Please note the lower case 'c' on cantSegundos.<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/8/22, grupo cft ing sostware <<a href="mailto:infocft@gmail.com">infocft@gmail.com
</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br clear="all"><font face="Tahoma" size="2">
<div>I meet working a simple example to interiorize with jboss rules and I obtain the following error:</div>
<div> </div>
<div><font color="#ff0000" size="2">
<p align="left">Exception in thread "main" org.drools.rule.InvalidRulePackage: Unable to create Field Extractor for 'CantSegundos' : [Rule name=Valida Duracion nula, agendaGroup=MAIN, salience=0, no-loop=false]
</p>
<p align="left"></p></font><u><font color="#000080" size="2">org.drools.RuntimeDroolsException</font></u></div></font><font color="#ff0000" size="2">: </font><u><font color="#000080" size="2">org.drools.RuntimeDroolsException
</font></u><font color="#ff0000" size="2">: java.lang.NullPointerExceptionUnable to create Field Extractor for 'CantSegundos' : [Rule name=valida Duracion , agendaGroup=MAIN, salience=0, no-loop=false]</font><u><font color="#000080" size="2">
<p align="left">org.drools.RuntimeDroolsException</p></font></u><font color="#ff0000" size="2">: </font><u><font color="#000080" size="2">org.drools.RuntimeDroolsException</font></u><font color="#ff0000" size="2">: </font>
<u><font color="#000080" size="2">java.lang.NullPointerException</font></u><font color="#ff0000" size="2">
<p align="left">at org.drools.rule.Package.checkValidity(</p></font><u><font color="#000080" size="2">Package.java:408</font></u><font color="#ff0000" size="2">)
<p align="left">at org.drools.common.AbstractRuleBase.addPackage(</p></font><u><font color="#000080" size="2">AbstractRuleBase.java:288</font></u><font color="#ff0000" size="2">)
<p align="left">at prototipo.Prueba.main(</p></font><u><font color="#000080" size="2">Prueba.java:27</font></u><font color="#ff0000" size="2">)</font>
<p align="left"><font color="#ff0000" size="2"><font color="#000000">the class main is:</font></font></p><font color="#ff0000" size="2"><font color="#000000"><b><font color="#7f0055" size="2">
<p align="left">public</p></font></b></font><font size="2"> </font><b><font color="#7f0055" size="2">static</font></b></font><font size="2"> </font><b><font color="#7f0055" size="2">final</font></b><font size="2"> </font>
<b><font color="#7f0055" size="2">void</font></b><font size="2"> main(String[] args) </font><b><font color="#7f0055" size="2">throws</font></b><font size="2"> Exception {
<p align="left"></p></font><b><font color="#7f0055" size="2"> final</font></b><font size="2"> PackageBuilder builder = </font><b><font color="#7f0055" size="2">new</font></b><font size="2"> PackageBuilder();
<p align="left"><strong> </strong>builder.addPackageFromDrl( </p></font><b><font color="#7f0055" size="2">new</font></b><font size="2"> InputStreamReader( Prueba.</font><b><font color="#7f0055" size="2">class</font>
</b><font size="2">.getResourceAsStream( </font><font color="#2a00ff" size="2">"regla.drl"</font><font size="2"> ) ) );</font><font size="2">
<p align="left"></p>
<p align="left"></p></font><b><font color="#7f0055" size="2"> final</font></b><font size="2"> RuleBase ruleBase = RuleBaseFactory.<i>newRuleBase</i>();
<p align="left"><strong> ruleBase</strong>.addPackage( builder.getPackage() );</p>
<p align="left"></p>
<p align="left"></p></font><b><font color="#7f0055" size="2"> final</font></b><font size="2"> StatefulSession session = ruleBase.newStatefulSession();
<p align="left"></p>
<p align="left"><strong> </strong>Integer segundos = </p></font><b><font color="#7f0055" size="2">new</font></b><font size="2"> Integer(5);
<p align="left"></p>
<p align="left"><strong> </strong>validaciones valida = </p></font><b><font color="#7f0055" size="2">new</font></b><font size="2"> validaciones();
</font><p align="left"><font size="2"><strong> </strong>valida.setCantSegundos(segundos);</font></p>
<p align="left"><font size="2"><strong> </strong>session.insert( valida);</font></p>
<p align="left"><font size="2"><strong> </strong>session.fireAllRules();</font></p>
<p align="left"><font size="2"><strong>in the rules is:</strong></font></p><font size="2"><strong><b><font color="#960000" size="2">
</font></b></strong></font><p align="left"><font size="2"><strong><b><font color="#960000" size="2">package</font></b></strong></font></p><font size="2"> prototipo
<p align="left"></p>
<p align="left"></p></font><b><font color="#960000" size="2">import</font></b><font size="2"> prototipo.validaciones;
<p align="left"></p>
<p align="left"></p></font><b><font color="#960000" size="2">rule</font></b><font size="2"> </font><font color="#008000" size="2">"Valida Duracion nula"
<p align="left"></p></font><b><font color="#960000" size="2">when
<p align="left"></p></font></b><font size="2"> v : validaciones(CantSegundos == 0)
<p align="left"></p>
<p align="left"></p></font><b><font color="#960000" size="2">then</font></b><font size="2">
<p align="left"> v.setResultado(</p></font><font color="#008000" size="2">"I"</font><font size="2">);
<p align="left"> System.out.println( </p></font><font color="#008000" size="2">"obtenemos"</font><font size="2"> + v.getResultado() );
<p align="left"></p>
<p align="left"></p></font><b><font color="#960000" size="2">end
<p align="left"></p></font></b><b><font color="#960000" size="2">rule</font></b><font size="2"> </font><font color="#008000" size="2">"valida Duracion "</font><font size="2"></font><b><font color="#960000" size="2">
when
<p align="left"></p></font></b><font size="2"> v : validaciones(CantSegundos > 0)
<p align="left"></p></font><b><font color="#960000" size="2">then</font></b><font size="2">
<p align="left"> v.setResultado(</p></font><font color="#008000" size="2">"S"</font><font size="2">);
<p align="left"> System.out.println( </p></font><font color="#008000" size="2">"obtenemos"</font><font size="2"> + v.getResultado());
<p align="left"></p>
<p align="left"></p></font><b><font color="#960000" size="2">end</font></b><strong><font face="Tahoma" size="2"><font face="Tahoma" size="2">
<p>Thank you for helping me.</p></font>
<p align="left"></p></font></strong><font color="#3f7f5f" size="2"><strong></strong></font><font size="2">
</font><p align="left"></p>
<p align="left"></p>
<p align="left"><font color="#ff0000" size="2"><font color="#000000"><strong></strong></font></font> </p>
<p align="left"><font color="#ff0000" size="2"><font color="#000000"></font> </font></p>
<br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>