[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2278) NPE after knowledgebase updated when using entrypoints

Michael Neale (JIRA) jira-events at lists.jboss.org
Mon Sep 14 19:29:23 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBRULES-2278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12485758#action_12485758 ] 

Michael Neale commented on JBRULES-2278:
----------------------------------------

To go with the attachment: 

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.

> NPE after knowledgebase updated when using entrypoints
> ------------------------------------------------------
>
>                 Key: JBRULES-2278
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2278
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core, drools-core  (expert), drools-core (fusion)
>    Affects Versions: 5.0.1.FINAL
>            Reporter: Michael Neale
>            Assignee: Edson Tirelli
>             Fix For: 5.1.0.M1
>
>         Attachments: kagent-problem.zip
>
>
> Raised by Nestor Burriel on the dev list: 
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list