[rules-dev] Drools Core Error?

nestabur nestabur at gmail.com
Mon Sep 14 11:10:05 EDT 2009


Hi again,

I haven't got any suggestion yet ... I've just wanted to know if this
configuration is possible in drools 5.0.1

Thanks again,

Nestor


nestabur wrote:
> 
> Hi Michael,
> 
> Attached a eclipse project with 2 sample apps showing my problem.
> 
> There are 2 main classes, 1 for CEP and STREAM enviroment and other
> without
> them.
> 
> The extrange behavior is that the engine keeps the Working Memory
> correctly
> and does the changes correctly in the nonTemporal enviroment
> (ksession.insert()) but at the Temporal enviroment
> (ksession.getWorkingMemoryEntryPoint("MyEntryPoint").insert(fact)) keeps
> the
> WM and doesnt change the RuleBase.
> 
> Both main classes have 1 parameter setting the drl path:
> file:src/main/resources/cepRule.drl
> file:src/main/resources/nonCepRule.drl
> 
> Try execute both enviroments, do changes inside the DRLs and see if the
> kagent updates the KSession correctly.
> 
> Thanks,
> 
> Nestor
> 
> PD: Actually I use both enviroments using the Guvnor PKG repository, in
> the
> post I wrote the error thrown if I use Guvnor instead DRL files but is the
> same problem as the attached project, the ksession doesnt refresh the
> KnowledgeBase in my Temporal enviroment.
> 
> 2009/9/1 Michael Neale <michael.neale at gmail.com>
> 
>> Hi Nestor - that is a tough one.
>>
>> I have a suspicion this is related to another issue I have seen with
>> deserliasation of rulebases when the MVEL JIT kicks in... (from that
>> strack trace it isn't getting the TypeDeclaration back...) - its a
>> stretch, but might be related to:
>> https://jira.jboss.org/jira/browse/JBRULES-2253
>>
>> As there are a few moving parts, if you could create a unit test that
>> starts up a agent and shows this behaviour, that would be appreciated
>> (confused about the interaction with entry points).
>>
>> Thanks,
>>
>> Michael.
>>
>>
>>
>> On Mon, Aug 31, 2009 at 8:38 PM, nestabur<nestabur at gmail.com> wrote:
>> >
>> > Any suggestions? I have my project in stand-by due to that problem ...
>> >
>> > Nestor
>> >
>> >
>> > 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/Drools-Core-Error--tp25188219p25221364.html
>> > Sent from the drools - dev mailing list archive at Nabble.com.
>> >
>> > _______________________________________________
>> > rules-dev mailing list
>> > rules-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-dev
>> >
>>
>>
>>
>> --
>> Michael D Neale
>> home: www.michaelneale.net
>> blog: michaelneale.blogspot.com
>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
> 
>  
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/Drools-Core-Error--tp25188219p25437601.html
Sent from the drools - dev mailing list archive at Nabble.com.



More information about the rules-dev mailing list