[rules-users] help, Unable to create Field Extractor for ....

Edson Tirelli tirelli at post.com
Wed Aug 22 17:16:30 EDT 2007


   DRL rule is case sensitive, so you should write, according to the
javabean spec:

           v : validaciones(cantSegundos == 0)
   Please note the lower case 'c' on cantSegundos.

   []s
   Edson

2007/8/22, grupo cft ing sostware <infocft at gmail.com>:
>
>
> I meet working a simple example to interiorize with jboss rules and I
> obtain the following error:
>
>
> 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]
>
> *org.drools.RuntimeDroolsException*
> : *org.drools.RuntimeDroolsException *:
> java.lang.NullPointerExceptionUnable to create Field Extractor for
> 'CantSegundos' : [Rule name=valida Duracion , agendaGroup=MAIN, salience=0,
> no-loop=false]*
>
> org.drools.RuntimeDroolsException
> *: *org.drools.RuntimeDroolsException*: *java.lang.NullPointerException*
>
> at org.drools.rule.Package.checkValidity(
> *Package.java:408*)
>
> at org.drools.common.AbstractRuleBase.addPackage(
> *AbstractRuleBase.java:288*)
>
> at prototipo.Prueba.main(
> *Prueba.java:27*)
>
> the class main is:
> *
>
> public
> * *static* *final* *void* main(String[] args) *throws* Exception {
>
> *             final* PackageBuilder builder = *new* PackageBuilder();
>
> *            *builder.addPackageFromDrl(
> *new* InputStreamReader( Prueba.*class *.getResourceAsStream( "regla.drl") ) );
>
> *            final* RuleBase ruleBase = RuleBaseFactory.*newRuleBase*();
>
> *           ruleBase*.addPackage( builder.getPackage() );
>
> *            final* StatefulSession session = ruleBase.newStatefulSession();
>
>
> *          *Integer segundos =
> *new* Integer(5);
>
> *            *validaciones valida =
> *new* validaciones();
>
> *           *valida.setCantSegundos(segundos);
>
> *          *session.insert( valida);
>
> *           *session.fireAllRules();
>
> *in the rules is:*
> * *
>
> *package*
> prototipo
>
> *import* prototipo.validaciones;
>
> *rule* "Valida Duracion nula"
>
> *when
>
> *           v : validaciones(CantSegundos == 0)
>
> *then*
>
>               v.setResultado(
> "I");
>
>              System.out.println(
> "obtenemos" + v.getResultado() );
>
> *end
>
> **rule* "valida Duracion "* when
>
> *              v : validaciones(CantSegundos > 0)
>
> *then*
>
>            v.setResultado(
> "S");
>
>             System.out.println(
> "obtenemos" + v.getResultado());
>
> *end**
>
> Thank you for helping me.
>
> ***
>
>  **
>
>
>
> _______________________________________________
> 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/20070822/c4bb2a88/attachment-0001.html 


More information about the rules-users mailing list