[rules-users] CEP Error

Nicolas Héron nicolas.heron.java at gmail.com
Wed Feb 10 14:41:40 EST 2010


Hi again,
if you want to show the attribute name just do $param.name, there is no need
for ()
If it is a method, put a dummy parameter
Regards
Nicolas

2010/2/10 Glenn Macgregor <gmacgregor at pocketkings.ie>

> Hi Nicolas,
>
> Thanks for the response. The strange thing is I do not get this error when
> I run inside the debugger with the same facts. This made me believe it is a
> timing issue. I am using the latest stable drools - 5.0.1
>
> Thanks
>
> Glenn
>
> ------------------------------
>  *From*: rules-users-bounces at lists.jboss.org
> *To*: Rules Users List
> *Sent*: Wed Feb 10 18:18:57 2010
> *Subject*: Re: [rules-users] CEP Error
>
> Hi,
> It says that the $param is null so $param.name() cannot be called
> regards
> Nicolas
>
> 2010/2/10 Glenn Macgregor <gmacgregor at pocketkings.ie>
>
>>  Hi All,
>>
>>
>>
>> I have a simple CEP test case which I am working through. I am currently
>> getting a NullPointerException in the Consequence and have no idea why.
>>
>>
>>
>> *Rule:
>> **rule* "Param Update Event Rule"
>>
>>       *when*
>>
>>             $pue : ParameterUpdateEvent(name == "testParam2", $param :
>> param) *from* entry-point "ParamUpdateStream"
>>
>>       *then*
>>
>>             #System.out.println("Param '" + $pue.getName() + "' has been
>> updated to " + $pue.getValue());
>>
>>             System.out.println("HERE!!! " + $param + " " + $param.name()
>> );
>>
>> *End*
>>
>> * *
>>
>> *Exception & Debug:*
>>
>> OBJECT ASSERTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 1265109factId: 2
>>
>> OBJECT RETRACTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 1265109factId: 2
>>
>> OBJECT ASSERTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 5e8d7dfactId: 3
>>
>> OBJECT RETRACTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 5e8d7dfactId: 3
>>
>> ACTIVATION CREATED rule:Param Update Event Rule activationId:Param Update
>> Event Rule [4, 0] declarations:
>> $pue=ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 19b4748(4);
>> $param=ie.PocketKings.SystemsManagement.Alerting.Parameter at 2431b9(4)
>>
>> Exception in thread "Thread-3" BEFORE ACTIVATION FIRED rule:Param Update
>> Event Rule activationId:Param Update Event Rule [4, 0] declarations:
>> $pue=ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 19b4748(4);
>> $param=ie.PocketKings.SystemsManagement.Alerting.Parameter at 2431b9(4)
>>
>> OBJECT RETRACTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 19b4748factId: 4
>>
>> OBJECT ASSERTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 19b4748factId: -1
>>
>> *org.drools.runtime.rule.ConsequenceException*: *
>> java.lang.NullPointerException*
>>
>>       at
>> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(
>> *DefaultConsequenceExceptionHandler.java:23*)
>>
>>       at org.drools.common.DefaultAgenda.fireActivation(*
>> DefaultAgenda.java:943*)
>>
>>       at org.drools.common.DefaultAgenda.fireNextItem(*
>> DefaultAgenda.java:885*)
>>
>>       at org.drools.common.DefaultAgenda.fireUntilHalt(*
>> DefaultAgenda.java:1065*)
>>
>>       at org.drools.common.AbstractWorkingMemory.fireUntilHalt(*
>> AbstractWorkingMemory.java:701*)
>>
>>       at org.drools.common.AbstractWorkingMemory.fireUntilHalt(*
>> AbstractWorkingMemory.java:678*)
>>
>>       at org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(*
>> StatefulKnowledgeSessionImpl.java:195*)
>>
>>       at ie.PocketKings.SystemsManagement.Alerting.SessionRunner.run(*
>> SessionRunner.java:13*)
>>
>>       at java.lang.Thread.run(Unknown Source)
>>
>> Caused by: *java.lang.NullPointerException*
>>
>>       at
>> org.drools.base.ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent6011238$getParam.getValue(Unknown
>> Source)
>>
>>       at org.drools.base.ClassFieldReader.getValue(*
>> ClassFieldReader.java:91*)
>>
>>       at org.drools.rule.Declaration.getValue(*Declaration.java:244*)
>>
>>       at
>> ie.PocketKings.SystemsManagement.Alerting.Rule_Param_Update_Event_Rule_0ConsequenceInvoker.evaluate(
>> *Rule_Param_Update_Event_Rule_0ConsequenceInvoker.java:16*)
>>
>>       at org.drools.common.DefaultAgenda.fireActivation(*
>> DefaultAgenda.java:934*)
>>
>>       ... 7 more
>>
>> OBJECT ASSERTED
>> value:ie.PocketKings.SystemsManagement.Alerting.ParameterUpdateEvent at 19fdbcbfactId: 5
>>
>>
>>
>>
>>
>> Could it be that my Event object is getting destroyed before the
>> consequence is run, is that what “OBJECT RETRACKED” means in this case?
>>
>>
>>
>> Thanks
>>
>>
>>
>>  Glenn
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> 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/20100210/fda1b087/attachment.html 


More information about the rules-users mailing list