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

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Thu Dec 3 12:00:31 EST 2009


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

Edson Tirelli commented on JBRULES-2278:
----------------------------------------

Ok, you are using drools 5.0.1. So I switched my project to use drools 5.0.1. I ran your temporal test, let it fire the rule a few times, made a change in the DRL file, let it update and fire the rules again. No problem in my environment. Log snippet:

(...)
[2009:12:337 11:12:674:debug] ResourceChangeScanner attempt to scan 1 resources
[2009:12:337 11:12:674:debug] ResourceChangeScanner thread is waiting for 10
******************** Temporal Rule Fired Thu Dec 03 11:57:02 EST 2009
******************** Temporal Rule Fired 
******************** Temporal Rule Fired Thu Dec 03 11:57:07 EST 2009
******************** Temporal Rule Fired 
[2009:12:337 11:12:674:debug] ResourceChangeScanner attempt to scan 1 resources
[2009:12:337 11:12:675:debug] ResourceChangeScanner modified resource=[UrlResource path='file:src/main/resources/cepRule.drl'] : 1259859088237 : 1259859440113
[2009:12:337 11:12:676:debug] ResourceChangeNotification received ChangeSet notification
[2009:12:337 11:12:676:debug] ResourceChangeScanner thread is waiting for 10
[2009:12:337 11:12:676:debug] ResourceChangeNotification processing ChangeSet
[2009:12:337 11:12:677:debug] ResourceChangeNotification ChangeSet modified resource=[UrlResource path='file:src/main/resources/cepRule.drl'] for listener=org.drools.agent.impl.KnowledgeAgentImpl at 1e45a5c
[2009:12:337 11:12:677:debug] ResourceChangeNotification ChangeSet modified resource=[UrlResource path='file:src/main/resources/cepRule.drl'] for listener=kagent.test.changeset.notifficator.DroolsEngineResourceNotifier at 1954f89
[2009:12:337 11:12:677:debug] KnowledgeAgent received ChangeSet changed notification
[2009:12:337 11:12:677:info] KnowledgAgent applying ChangeSet
[2009:12:337 11:12:677:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder
[2009:12:337 11:12:678:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[2009:12:337 11:12:685:debug] KnowledgeAgent building resource=[UrlResource path='file:src/main/resources/cepRule.drl']
[2009:12:337 11:12:872:info] KnowledgeAgent new KnowledgeBase now built and in use
******************** Temporal Rule Fired Thu Dec 03 11:57:12 EST 2009
******************** Temporal Rule Fired 
******************** Temporal Rule Fired Thu Dec 03 11:57:17 EST 2009
******************** Temporal Rule Fired 
[2009:12:337 11:12:676:debug] ResourceChangeScanner attempt to scan 1 resources
*************** Updating KSession
[2009:12:337 11:12:677:debug] ResourceChangeScanner thread is waiting for 10
*************** #Rule:1
[2009:12:337 11:12:679:debug] ResourceChangeNotification thread is waiting for queue update
******************** Temporal Rule Fired Thu Dec 03 11:57:22 EST 2009
******************** Temporal Rule Fired 
******************** Temporal Rule Fired Thu Dec 03 11:57:27 EST 2009
******************** Temporal Rule Fired 
[2009:12:337 11:12:677:debug] ResourceChangeScanner attempt to scan 1 resources
[2009:12:337 11:12:678:debug] ResourceChangeScanner thread is waiting for 10
(...)

Edson

> 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.M2
>
>         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