[rules-users] Fusion [Error]- java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be cast to org.drools.common.EventFactHandle

Chetan Mahadev mahadev.chetan at gmail.com
Mon Nov 9 07:01:31 EST 2009


Hi Mauricio,,

I have already declared it as an event....  as shown below... yet it
cribs....


declare EligibleAlert
    @role( event )
//    @expires(90s)
end



rule "Check if EligibleAlert is an Signature Event"
agenda-group "enrichment"
auto-focus true
//salience 100
no-loop true
when
    $list : EventSignatureList();
    $p : EligibleAlert($a : alert, $a.eventSignatureProcessingStatus!="TRUE"
);

    eval((ifMatchesSyslog($list.getAllSyslogMnemonics(), $a)!=null)  )
then
        try{
                WorkingMemoryEntryPoint eventsignaturestream =
drools.getEntryPoint("EVENT SIGNATURE STREAM") ;
                eventsignaturestream.insert($p);
                } catch(Exception e)
        {
            log.error("[EventSignatureRules] - exception in Check if
EligibleAlert is an Signature Event alert[ids=" + $p.getAlert().getId() +
"][error:" + e.toString() + "]");
        }
end

2009/11/9 Mauricio Salatino <salaboy at gmail.com>

> Hi,
> Did you do something like:
> declare EligibleAlert
>  @role(event)
> end
>
> in your DRL?
> you need to declare which facts are events.
>
> 2009/11/9 Chetan Mahadev <mahadev.chetan at gmail.com>
>
>>
>> Hi I am getting the following error while inserting into the entrypoint.
>>
>> rule "Check if EligibleAlert is an Signature Event"
>> agenda-group "enrichment"
>> auto-focus true
>>
>> no-loop true
>> when
>>     $list : EventSignatureList();
>>     $p : EligibleAlert($a : alert,
>> $a.eventSignatureProcessingStatus!="TRUE" );
>>     eval((ifMatchesSyslog($list.getAllSyslogMnemonics(), $a)!=null)  )
>>
>> then
>>         try{
>>                 WorkingMemoryEntryPoint eventsignaturestream =
>> drools.getEntryPoint("EVENT SIGNATURE STREAM") ;
>>                 eventsignaturestream.insert($p);
>>                 } catch(Exception e)
>>         {
>>             log.error("[EventSignatureRules] - exception in Check if
>> EligibleAlert is an Signature Event alert[ids=" + $p.getAlert().getId() +
>> "][error:" + e.toString() + "]");
>>         }
>> end
>>
>> And I am creating the session this way:
>> *
>>         knowledgeBaseConfig =
>> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>>         knowledgeBaseConfig.setOption( EventProcessingOption.STREAM );
>>         kBase = KnowledgeBaseFactory.newKnowledgeBase( knowledgeBaseConfig
>> );
>>
>>
>>
>> kBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());
>>
>>
>>         KnowledgeSessionConfiguration knowledgeSessionConfig =
>> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
>>         ((SessionConfiguration) knowledgeSessionConfig).setClockType(
>> ClockType.REALTIME_CLOCK );
>>           kBase.newStatefulKnowledgeSession(knowledgeSessionConfig,null);
>> *
>>
>>
>> I get the Following error when my rule fires:
>>
>> 2009-11-09 15:02:00,675 FATAL pool-2-thread-1 LogStream -
>> java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be
>> cast to org.drools.common.EventFactHandle
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:321)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.rule.VariableRestriction.isAllowedCachedRight(VariableRestriction.java:116)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.rule.VariableConstraint.isAllowedCachedRight(VariableConstraint.java:112)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.common.DefaultBetaConstraints.isAllowedCachedRight(DefaultBetaConstraints.java:200)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.reteoo.JoinNode.assertObject(JoinNode.java:172)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.reteoo.PropagationQueuingNode$AssertAction.execute(PropagationQueuingNode.java:326)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:221)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:394)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1486)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:158)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:122)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> pnoc.alertProcessor.Rule_Check_if_EligibleAlert_is_an_Signature_Event_0.consequence(Rule_Check_if_EligibleAlert_is_an_Signature_Event_0.java:16)
>> 2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
>> pnoc.alertProcessor.Rule_Check_if_EligibleAlert_is_an_Signature_Event_0ConsequenceInvoker.evaluate(Rule_Check_if_EligibleAlert_is_an_Signature_Event_0ConsequenceInvoker.java:24)
>>
>> Pls help!
>>
>>
>> Regds
>> Chetan
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> 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/20091109/393b7006/attachment.html 


More information about the rules-users mailing list