[jboss-jira] [JBoss JIRA] (JBRULES-3661) NullPointerException at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.getInterval(AfterEvaluatorDefinition.java:272)

Adrian Paredes (JIRA) jira-events at lists.jboss.org
Thu Nov 22 07:43:22 EST 2012


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

Adrian Paredes commented on JBRULES-3661:
-----------------------------------------

Hi! I reproduced the issue. The problem is when we use the KnowdedgeAgent, bringing rules remotely from the Guvnor repository, and we set the option EventProcessingOption.STREAM in the Knowledge Base (absolutely necessary for Drools to have notion of flow of time). It seems that, in this mode, Drools never reads the "drools.default.packagebuilder.conf" properties file located in drools-compiler.jar, where the temporal operators of Fusion are defined.

I tried to put this properties file in the META-INF folder of my project, but nothing happened. Debugging the drools-compiler code, I can not find the place where Drools reads this file. I think that it never does.

I found a workaround defining an array constant in wich I declare all the Fusion operators as elements. Something like this:

  private static final Operator[] extraOperators = {
    CoincidesEvaluatorDefinition.COINCIDES, CoincidesEvaluatorDefinition.COINCIDES_NOT,
    AfterEvaluatorDefinition.AFTER, AfterEvaluatorDefinition.NOT_AFTER,
    BeforeEvaluatorDefinition.BEFORE, BeforeEvaluatorDefinition.NOT_BEFORE,
    MeetsEvaluatorDefinition.MEETS, MeetsEvaluatorDefinition.MEETS_NOT,
    OverlapsEvaluatorDefinition.OVERLAPS, OverlapsEvaluatorDefinition.OVERLAPS_NOT,
    OverlappedByEvaluatorDefinition.OVERLAPPED_BY, OverlappedByEvaluatorDefinition.NOT_OVERLAPPED_BY,
    DuringEvaluatorDefinition.DURING, DuringEvaluatorDefinition.NOT_DURING,
    IncludesEvaluatorDefinition.INCLUDES, IncludesEvaluatorDefinition.INCLUDES_NOT,
    StartsEvaluatorDefinition.STARTS, StartsEvaluatorDefinition.STARTS_NOT,
    StartedByEvaluatorDefinition.STARTED_BY, StartedByEvaluatorDefinition.NOT_STARTED_BY,
    FinishesEvaluatorDefinition.FINISHES, FinishesEvaluatorDefinition.FINISHES_NOT,
    FinishedByEvaluatorDefinition.FINISHED_BY, FinishedByEvaluatorDefinition.NOT_FINISHED_BY,
    SetEvaluatorsDefinition.CONTAINS, SetEvaluatorsDefinition.EXCLUDES, SetEvaluatorsDefinition.MEMBEROF,
    SetEvaluatorsDefinition.NOT_CONTAINS, SetEvaluatorsDefinition.NOT_EXCLUDES, SetEvaluatorsDefinition.NOT_MEMBEROF,
    MatchesEvaluatorsDefinition.MATCHES, MatchesEvaluatorsDefinition.NOT_MATCHES,
    SoundslikeEvaluatorsDefinition.SOUNDSLIKE, SoundslikeEvaluatorsDefinition.NOT_SOUNDSLIKE
  };

Then I make sure to place this array in a class that is instantiated at the beginning of the application.

It works, but it's not a very elegant solution.

Is there another option?
                
> NullPointerException 	at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.getInterval(AfterEvaluatorDefinition.java:272)
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-3661
>                 URL: https://issues.jboss.org/browse/JBRULES-3661
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>            Reporter: Kiran Kumar A
>            Assignee: Mark Proctor
>
> I am getting the below exception when creating knowledge base using knowledge agent. 
> The things I have done :
> I have created a package in Guvnor
> And uploaded a jar using 'New POJO Model Jar'
> And declared some of the POJOs as events using 'New declarative MOdel'
> I added role and timestamp annotations to declare them as events.
> I wrote CEP rules. The below is the one of the rule.
> rule 'Rule 1'
> when 
> $eventA: EventA($eventId:eventId) from enrtry-point "STREAM1"
> not EventB($eventId == eventId, this after[0s,3m] $eventA) from enrtry-point "STREAM1"
> then
> helper.doAction1($eventA);
> I built package. And downloaded changeset.xml.
> Copied the changeset to project classpath. 
> I created web application having rule engine as a component.
> I tried creating knowledge base using knowledge agent. 
> ava.lang.NullPointerException
> 	at org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.getInterval(AfterEvaluatorDefinition.java:272)
> 	at org.drools.rule.constraint.EvaluatorConstraint.getInterval(EvaluatorConstraint.java:100)
> 	at org.drools.reteoo.builder.BuildUtils.gatherTemporalRelationships(BuildUtils.java:326)
> 	at org.drools.reteoo.builder.BuildUtils.calculateTemporalDistance(BuildUtils.java:292)
> 	at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:113)
> 	at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:116)
> 	at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:445)
> 	at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:956)
> 	at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:627)
> 	at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)
> 	at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
> 	at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1085)
> 	at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:971)
> 	at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:675)
> 	at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:203)
> 	at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:182)
> 	at com.abccomp.rules.engine.impl.GuvnorKnowledgeBaseProvider.createKnowledgeBase(GuvnorKnowledgeBaseProvider.java:126)
> 	at com.abccomp.rules.engine.impl.RuleEngineImpl.start(RuleEngineImpl.java:203)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
> 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
> 	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
> 	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> 	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
> 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
> 	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
> 	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
> 	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
> 	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
> 	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
> 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
> 	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
> 	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
> 	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
> 	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
> 	at java.lang.Thread.run(Thread.java:680)
> 2012-10-17 19:07:59,761 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR com.abccomp.rules.engine.impl.RuleEngineImpl - Error while starting knolwdge base
> java.lang.Exception: Error while creating knowledge base
> 	at com.abccomp.rules.engine.impl.GuvnorKnowledgeBaseProvider.createKnowledgeBase(GuvnorKnowledgeBaseProvider.java:136)
> 	at com.abccomp.rules.engine.impl.RuleEngineImpl.start(RuleEngineImpl.java:203)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
> 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
> 	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
> 	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> 	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
> 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
> 	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
> 	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
> 	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
> 	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
> 	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
> 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
> 	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
> 	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
> 	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
> 	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
> 	at java.lang.Thread.run(Thread.java:680)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list