[rules-users] Using KnowledgeAgent with Stateful session

James Owen jco2009 at att.net
Wed Aug 26 17:31:04 EDT 2009


Greetings:

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 http://www.fipa.org/  
for more information.

SDG
James Owen
Founder October Rules Fest
Senior Consultant / Architect KBSC
http://www.kbsc.com
http://www.OctoberRulesFest.org
Twitter: OctRulesFest
Blogs:
http://JavaRules.blogspot.com [Rulebased Systems Blog]
http://ORF2009.blogspot.com [October Rules Fest Blog]
http://exscg.blogspot.com/ [Expert Systems Consulting Group Blog]

"If I have seen a little further it is by standing on the shoulders of  
giants."
Sir Isaac Newton in a letter to Robert Hooke, 5 Feb 1676

Come to October Rules Fest and stand on the shoulders of the Giants of  
the industry; if only for a week.



On Aug 26, 2009, at 11:34 AM, nestabur wrote:

>
>
> Does anyone tried to use the knowledgeAgent with statefulSessions?
>
> I've tried to configure my rule engine obtaining unexpected behaviour.
>
> I configure my statefulSession as follows:
>
> wm = (ReteooStatefulSession) ((KnowledgeBaseImpl) kagent
> 				.getKnowledgeBase()).ruleBase.newStatefulSession(
> 				(SessionConfiguration) sessionConf, env);
> ksession = new StatefulKnowledgeSessionImpl(wm,  
> kagent.getKnowledgeBase());
>
> And after updating the KnowledgeBase in the agent I update my  
> ksession:
>
> wm.setRuleBase((InternalRuleBase) ((KnowledgeBaseImpl) kagent
> 						.getKnowledgeBase()).ruleBase);		
> ksession = new StatefulKnowledgeSessionImpl(wm,  
> kagent.getKnowledgeBase());
>
> Without using entry-points this approach works as expected, but  
> using them
> it fails after the first update throwing the error:
>
> Exception while processing message: java.lang.NullPointerException
> java.lang.NullPointerException
> 	at
> org 
> .drools 
> .reteoo 
> .ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java: 
> 54)
> 	at
> org 
> .drools 
> .common 
> .AbstractFactHandleFactory 
> .newFactHandle(AbstractFactHandleFactory.java:79)
> 	at
> org 
> .drools 
> .common 
> .AbstractFactHandleFactory 
> .newFactHandle(AbstractFactHandleFactory.java:66)
> 	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:109)
> 	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)
> 	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)
>
> Browsing the drools core code I found the line that was throwing the
> exception and tried to get the same result by implementing:
>
> if (!((InternalRuleBase) ((KnowledgeBaseImpl)
> ksession.getKnowledgeBase()).ruleBase)
> 				.getTypeDeclaration(fact.getClass()) == null)
> 	log.info (((InternalRuleBase) ((KnowledgeBaseImpl)
> ksession.getKnowledgeBase()).ruleBase)
> 				
> .getTypeDeclaration 
> (fact.getClass()).getTimestampExtractor().toString());
>
> after updating my ksession. The result was the same, again the same
> exception thrown but my logger wrote:
> 18:01:50,232 INFO [ClassFieldExtractor class=MyPackage.MyFact
> field=myTimestampField]
>
> So I dont know why the core is throwing that exception, is that
> implementation correct?, any ideas?
>
>
> Thanks,
>
> Nestor
>
> -- 
> View this message in context: http://www.nabble.com/Using-KnowledgeAgent-with-Stateful-session-tp25151447p25151447.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> 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/20090826/f3daf7ee/attachment.html 


More information about the rules-users mailing list