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

Edson Tirelli ed.tirelli at gmail.com
Mon Nov 9 08:53:08 EST 2009


   The stack trace shows the problem is happening in a use of the "after"
evaluator:

2009-11-09 15:02:00,676 FATAL pool-2-thread-1 LogStream -       at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:321)

    So, the attached rule is not the source of the problem, although it
might be the rule "triggering" the problem because of the event forwarding
in the consequence. Remember that the After operator is supposed to work on
events, java.util.Date, and long (for timestamps). Anything else will raise
errors.

    Finally, on a different subject, you can simplify your consequence, as
this:

WorkingMemoryEntryPoint eventsignaturestream = drools.getEntryPoint("EVENT
SIGNATURE STREAM") ;
eventsignaturestream.insert($p);

   Is the same as:

entryPoints["EVENT SIGNATURE STREAM"].insert( $p );

   []s
   Edson

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


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091109/4bbf6ad6/attachment.html 


More information about the rules-users mailing list