<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Greetings:<div><br></div><div>Nobody seems to be replying and I'm not really "qualified" to reply but I might be able to point you in the right direction. Long, long ago in a land far, far away we did a really cool project using Intelligent Agents and employed most of the technology from FIPA, The Foundation for Intelligent Physical Agents; see <a href="http://www.fipa.org/">http://www.fipa.org/</a> for more information. </div><div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>SDG</div><div>James Owen</div><div>Founder October Rules Fest</div><div>Senior Consultant / Architect KBSC</div><div><span class="Apple-style-span" style="font-family: 'Bodoni SvtyTwo SC ITC TT'; "><font class="Apple-style-span" color="#976635"><a href="http://www.kbsc.com">http://www.kbsc.com</a></font></span></div><div><span class="Apple-style-span" style="font-family: 'Bodoni SvtyTwo SC ITC TT'; "><font class="Apple-style-span" color="#976635"><a href="http://www.OctoberRulesFest.org">http://www.OctoberRulesFest.org</a></font></span></div><div><font class="Apple-style-span" face="'Bodoni SvtyTwo SC ITC TT'"><font class="Apple-style-span" color="#976635">Twitter: OctRulesFest</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF">Blogs:</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF"><a href="http://JavaRules.blogspot.com">http://JavaRules.blogspot.com</a> [Rulebased Systems Blog]</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF"><a href="http://ORF2009.blogspot.com">http://ORF2009.blogspot.com</a> [October Rules Fest Blog]</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF"><a href="http://exscg.blogspot.com/">http://exscg.blogspot.com/</a> [Expert Systems Consulting Group Blog]</font></font></div><div><font class="Apple-style-span" color="#0000FF" face="Garamond"><br></font></div><div><font class="Apple-style-span" color="#0000FF"><font class="Apple-style-span" face="'Lucida Handwriting'" size="4"><span class="Apple-style-span" style="font-size: 14px; "><i>"If I have seen a little further it is by standing on the shoulders of giants."</i></span></font></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px; "><b>Sir Isaac Newton in a letter to Robert Hooke, 5 Feb 1676</b></span></font></div><div><font class="Apple-style-span" color="#FF0000"><span class="Apple-style-span" style="font-size: medium; "><b><br></b></span></font></div><div><span class="Apple-style-span" style="font-size: medium; "><b>Come to October Rules Fest and stand on the shoulders of the Giants of the industry; if only for a week.</b></span></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 12px; line-height: 14px; -webkit-border-horizontal-spacing: 6px; -webkit-border-vertical-spacing: 6px; "><br></span></font></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></span></div></span></div></div></div></span></div></span><br class="Apple-interchange-newline"> </div><br><div><div>On Aug 26, 2009, at 11:34 AM, nestabur wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>Does anyone tried to use the knowledgeAgent with statefulSessions?<br><br>I've tried to configure my rule engine obtaining unexpected behaviour.<br><br>I configure my statefulSession as follows:<br><br>wm = (ReteooStatefulSession) ((KnowledgeBaseImpl) kagent<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>.getKnowledgeBase()).ruleBase.newStatefulSession(<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>(SessionConfiguration) sessionConf, env);<br>ksession = new StatefulKnowledgeSessionImpl(wm, kagent.getKnowledgeBase());<br><br>And after updating the KnowledgeBase in the agent I update my ksession:<br><br>wm.setRuleBase((InternalRuleBase) ((KnowledgeBaseImpl) kagent<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>.getKnowledgeBase()).ruleBase);<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><br>ksession = new StatefulKnowledgeSessionImpl(wm, kagent.getKnowledgeBase());<br><br>Without using entry-points this approach works as expected, but using them<br>it fails after the first update throwing the error:<br><br>Exception while processing message: java.lang.NullPointerException<br>java.lang.NullPointerException<br><span class="Apple-tab-span" style="white-space:pre">        </span>at<br>org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:54)<br><span class="Apple-tab-span" style="white-space:pre">        </span>at<br>org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:79)<br><span class="Apple-tab-span" style="white-space:pre">        </span>at<br>org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:66)<br><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:109)<br><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)<br><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)<br><br>Browsing the drools core code I found the line that was throwing the<br>exception and tried to get the same result by implementing:<br><br>if (!((InternalRuleBase) ((KnowledgeBaseImpl)<br>ksession.getKnowledgeBase()).ruleBase)<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>.getTypeDeclaration(fact.getClass()) == null)<br><span class="Apple-tab-span" style="white-space:pre">        </span>log.info (((InternalRuleBase) ((KnowledgeBaseImpl)<br>ksession.getKnowledgeBase()).ruleBase)<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><br>.getTypeDeclaration(fact.getClass()).getTimestampExtractor().toString());<br><br>after updating my ksession. The result was the same, again the same<br>exception thrown but my logger wrote:<br>18:01:50,232 INFO [ClassFieldExtractor class=MyPackage.MyFact<br>field=myTimestampField]<br><br>So I dont know why the core is throwing that exception, is that<br>implementation correct?, any ideas?<br><br><br>Thanks,<br><br>Nestor<br><br>-- <br>View this message in context: <a href="http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html">http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html</a><br>Sent from the drools - user mailing list archive at Nabble.com.<br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></div></blockquote></div><br></div></body></html>