[rules-users] Problem with package names and declare section

Wolfgang Laun wolfgang.laun at gmail.com
Thu Feb 9 14:55:17 EST 2012


The NPE during insertion is highly suggestive of another problem. Even if
there were two Event classes (one the pojo, the other one the declared one)
there should not be a NPE; the "hello world" rule simply would not fire.
Are all fields - especially eventName - properly initialized before that
fact is inserted?

-W

2012/2/9 Joaquín Díaz Vélez <joaquin.diazvelez at fluxit.com.ar>

> Hi guys,
>
>             we are currently working with Drools Fusion in order to build
> a complex event processing solution. We've modelled our events using and
> object (Event) and this object is shared with everyone that needs to
> publish and event.
>
>             Our scenario goes this way
>
> 1) Our shared class, located in *ar.com.fluxit.Event*
>
> 2) An example of our cep rules declared in package *rules.flux*
>
>     package *rules.flux*
>
>     import *ar.com.fluxit.Event;*
>
>     declare *Event*
> @role (event)
>  @expires(1m)
>     end
>
>     rule "hello world"
> when
>     $event:Event( eventName == "Hello World") from entry-point "*
> rules.flux*"
> then
>      System.out.println("Hello world");
>         end
>
>
> 3) When we try to insert a *ar.com.fluxit.Event *as a fact in entry point
> "rules.flux" Drools Fusion throws a NullPointerException. If you read
> Drools Expert documentation (
> http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/ch05.html#d0e3661
>  -
> Accessing Declared Types from the Application Code) you find this
> paragraph:
> "The first important thing to realize is that a declared fact will belong
> to the package where it was declared. So, for instance, in the example
> below, Person will belong to the org.drools.examples package, and so the
> fully qualified name of the generated class will be
> org.drools.examples.Person."
>
> When we change package declaration to *package ar.com.fluxit *everything
> works like a charm. But in our cep scenario we need that our
> ar.com.fluxit.Event object to be user by all rules declared in any package.
>
> So, there goes the question. There is a workaround for this? This is a
> bug?
>
> Any help would be very appreciated
>
>
> Cheers
>
>
> --
> Joaquín Díaz Vélez
>
> Flux IT SA
> Calle 9 N° 865 - Paseo La Panadería - Planta Alta
> La Plata - Buenos Aires - Argentina
> Teléfono (+54) 221 553 2980 int 306
> Móvil (+54) 9221 5863322
>     www.fluxit.com.ar
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120209/069d625e/attachment.html 


More information about the rules-users mailing list