Today I&#39;ve reported a similar (?) problem with KnowledgeAgent ind combination with declare: the type of the inserted wasn&#39;t recognized, and rules didn&#39;t fire.<div><br></div><div>Please check that this produces the correct class name:</div>
<div><br></div><div>rule justTestClass</div><div>salience 1000000</div><div>when</div><div>then</div><div>    Event event = new Event();</div><div>    System.out.println( event.getName() );</div><div>  //   insert( event );</div>
<div>end</div><div><br></div><div>If it does, uncomment and try again: Does insert work from DRL?</div><div><br></div><div>-W<br><br><div class="gmail_quote">2012/2/10 Joaquín Díaz Vélez <span dir="ltr">&lt;<a href="mailto:joaquin.diazvelez@fluxit.com.ar">joaquin.diazvelez@fluxit.com.ar</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">W, thanks for your reply. The Event fields are all complete and initialized. If I change the rule package to the one in Event  (let&#39;s say &quot;package-name(rule) == package-name(Event)&quot;) everything works like a charm. I&#39;ll give you more details about the NPE. <div>

<br></div><div>Happends in this class:  org.drools.reteoo.ReteooFactHandleFactory, method:</div><div><br></div><div><div>    protected final InternalFactHandle newFactHandle(final int id,</div>
<div>                                                     final Object object,</div><div>                                                     final long recency,</div><div>                                                     <b>final ObjectTypeConf conf,</b></div>


<div>                                                     final InternalWorkingMemory workingMemory,</div><div>                                                     final WorkingMemoryEntryPoint wmEntryPoint) {</div></div>


<div><div><br></div><div>        if ( conf != null &amp;&amp; conf.isEvent() ) {</div><div><b>            TypeDeclaration type = conf.getTypeDeclaration();</b></div><div>            long timestamp;</div><div><b>            if ( type.getTimestampExtractor() != null ) { --&gt; NPE here, because type is null</b></div>


<div>                if ( Date.class.isAssignableFrom( type.getTimestampExtractor().getExtractToClass() ) ) {</div><div>                    timestamp = ((Date) type.getTimestampExtractor().getValue( workingMemory,</div><div>


                                                                               object )).getTime();</div></div><div>        (...) etc</div><div>}</div><div><br></div><div>So, <b>type </b>is null (shouldn&#39;t be). I debugged the execution and I found that ObjectTypeConfigurationRegistry is holding this instance of <b>conf.</b></div>

<div><br></div><div>Any ideas?</div><div><br></div><div>Thanks in advance</div><div><br><br><div class="gmail_quote">2012/2/9 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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 &quot;hello world&quot; rule simply would not fire. Are all fields - especially eventName - properly initialized before that fact is inserted? <br>



<br>-W<br><br><div class="gmail_quote"><div><div>2012/2/9 Joaquín Díaz Vélez <span dir="ltr">&lt;<a href="mailto:joaquin.diazvelez@fluxit.com.ar" target="_blank">joaquin.diazvelez@fluxit.com.ar</a>&gt;</span><br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div>Hi guys,</div><div><br></div><div>            we are currently working with Drools Fusion in order to build a complex event processing solution. We&#39;ve modelled our events using and object (Event) and this object is shared with everyone that needs to publish and event. </div>




<div><br></div><div>            Our scenario goes this way</div><div><br></div><div>1) Our shared class, located in <b>ar.com.fluxit.Event</b></div><div><br></div><div>2) An example of our cep rules declared in package <b>rules.flux</b></div>




<div><br></div><div>    package <b>rules.flux</b></div><div><div><br></div><div>    import <b>ar.com.fluxit.Event;</b></div><div><br></div><div>    declare <b>Event</b></div><div><span style="white-space:pre-wrap">        </span>@role (event)</div>




<div><span style="white-space:pre-wrap">        </span>@expires(1m)</div><div>    end</div><div><br></div><div><div>    rule &quot;hello world&quot;</div><div><span style="white-space:pre-wrap">        </span>when</div>
<div><span style="white-space:pre-wrap">                </span>    $event:Event( eventName == &quot;Hello World&quot;) from entry-point &quot;<b>rules.flux</b>&quot;</div><div><span style="white-space:pre-wrap">        </span>then</div>
<div><span style="white-space:pre-wrap">                </span>    System.out.println(&quot;Hello world&quot;);</div><div>        end</div></div><div><br></div><div><div><br></div></div><div>3) When we try to insert a <b>ar.com.fluxit.Event </b>as a fact in entry point &quot;rules.flux&quot; Drools Fusion throws a NullPointerException. If you read Drools Expert documentation (<a href="http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/ch05.html#d0e3661" target="_blank">http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/ch05.html#d0e3661</a> - </div>




<h3 style="color:rgb(74,93,117);line-height:20px;margin-top:0em;font-family:&#39;Lucida Grande&#39;,Geneva,Verdana,Arial,sans-serif;padding-top:0em;padding-bottom:0em;text-align:justify"><a><font style="font-weight:normal" size="2">Accessing Declared Types from the Application Code) you find this paragraph:</font></a></h3>




<div><a style="color:rgb(51,51,51);font-family:&#39;Lucida Grande&#39;,Geneva,Verdana,Arial,sans-serif;font-size:12px;line-height:18px;text-align:justify">&quot;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, <code style="font-size:0.9em;font-family:courrier,monospace;white-space:nowrap">Person</code> will belong to the <code style="font-size:0.9em;font-family:courrier,monospace;white-space:nowrap">org.drools.examples</code> package, and so the fully qualified name of the generated class will be <code style="font-size:0.9em;font-family:courrier,monospace;white-space:nowrap">org.drools.examples.Person</code>.&quot;</a></div>




<div><br></div><div>When we change package declaration to <b>package ar.com.fluxit </b>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. </div>




<div><br></div><div>So, there goes the question. There is a workaround for this? This is a bug? </div><div><br></div><div>Any help would be very appreciated</div><div><br></div><div><br></div><div>Cheers</div><span><font color="#888888"><div>



<br clear="all">
<div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:medium;border-collapse:collapse"><div style="font-size:13px;margin-top:5px;margin-right:15px;margin-bottom:5px;margin-left:15px;padding-bottom:20px">




<div>Joaquín Díaz Vélez<br><br>Flux IT SA<br>Calle 9 N° 865 - Paseo La Panadería - Planta Alta<div>La Plata - Buenos Aires - Argentina<br></div>Teléfono (+54) <span style="font-family:arial;font-size:small;border-collapse:separate">221 553 2980</span> int 306</div>




<div><div>Móvil <a href="tel:%28%2B54%29%209221%205863322" value="+5492215863322" target="_blank">(+54) 9221 5863322</a></div></div></div></span><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">    <a href="http://www.fluxit.com.ar" style="color:rgb(42,93,176)" target="_blank">www.fluxit.com.ar</a></span><span style="font-family:arial,sans-serif;font-size:medium;border-collapse:collapse"><div style="font-size:13px;margin-top:5px;margin-right:15px;margin-bottom:5px;margin-left:15px;padding-bottom:20px">




<div><br></div></div><div style="font-size:13px;margin-top:5px;margin-right:15px;margin-bottom:15px;margin-left:15px;clear:both"></div><div style="background-color:rgb(247,247,247);padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;width:auto;background-repeat:initial initial">




</div><div style="font-size:13px;background-color:rgb(247,247,247);padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;width:auto;background-repeat:initial initial">




</div></span><br>
</div></font></span></div>
<br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a 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>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:medium;border-collapse:collapse"><div style="font-size:13px;margin-top:5px;margin-right:15px;margin-bottom:5px;margin-left:15px;padding-bottom:20px">


<div>Joaquín Díaz Vélez<br><br>Flux IT SA<br>Calle 9 N° 865 - Paseo La Panadería - Planta Alta<div>La Plata - Buenos Aires - Argentina<br></div>Teléfono (+54) <span style="font-family:arial;font-size:small;border-collapse:separate">221 553 2980</span> int 306</div>


<div><div>Móvil <a href="tel:%28%2B54%29%209221%205863322" value="+5492215863322" target="_blank">(+54) 9221 5863322</a></div></div></div></span><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">    <a href="http://www.fluxit.com.ar" style="color:rgb(42,93,176)" target="_blank">www.fluxit.com.ar</a></span><span style="font-family:arial,sans-serif;font-size:medium;border-collapse:collapse"><div style="font-size:13px;margin-top:5px;margin-right:15px;margin-bottom:5px;margin-left:15px;padding-bottom:20px">


<div><br></div></div><div style="font-size:13px;margin-top:5px;margin-right:15px;margin-bottom:15px;margin-left:15px;clear:both"></div><div style="background-color:rgb(247,247,247);padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;width:auto;background-repeat:initial initial">


</div><div style="font-size:13px;background-color:rgb(247,247,247);padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;width:auto;background-repeat:initial initial">


</div></span><br>
</font></span></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a 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></div>