[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2433) Facts with event roles in process constraints cause exception
Kris Verlaenen (JIRA)
jira-events at lists.jboss.org
Thu Mar 4 19:30:17 EST 2010
[ https://jira.jboss.org/jira/browse/JBRULES-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12518255#action_12518255 ]
Kris Verlaenen commented on JBRULES-2433:
-----------------------------------------
Actually, in this case, both your rules and ruleflow should share the same event definition. It is however currently not possible to define something as an event in a ruleflow file, you should do that in a separate drl file that accompanies the ruleflow and defines the event. We usually recommend people to use a *.package file to contain common definitions like imports, functions etc. that can be shared across rule files, but this is no different when combining rules and ruleflows. I suggest you create a .package file that contains the event definition (and possibly other shared stuff). You need to load this before loading your other rules or ruleflows that depend on this.
It is of course possible to take your current rule file and see that as the package file, containing not only your common definitions but also some dedicated rules. That's the reason why loading the rules before the process should also fix this issue in this situation.
> Facts with event roles in process constraints cause exception
> -------------------------------------------------------------
>
> Key: JBRULES-2433
> URL: https://jira.jboss.org/jira/browse/JBRULES-2433
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Reporter: Paul Borlin
> Assignee: Edson Tirelli
> Attachments: Test.zip
>
>
> When the following conditions are met, a runtime exception is thrown when the following said type is inserted into working memory:
> 1. A ruleflow and rule definition are asserted into the knowledgebase
> 2. The rule definition declares a type as being an "event". (declare myType @role( event ) @timestamp( value ) end )
> 3. The ruleflow references that type in a constraint.
> 4. A rule in the rule definition has a LHS constraint that references that type as an event (i.e., code such as "over window:time( 12M )" is used)
> Attached is a JUnit test that reproduces issue. The following stack trace is the result:
> java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be cast to org.drools.common.EventFactHandle
> at org.drools.rule.SlidingTimeWindow.updateNextExpiration(SlidingTimeWindow.java:198)
> at org.drools.rule.SlidingTimeWindow.assertRightTuple(SlidingTimeWindow.java:120)
> at org.drools.rule.BehaviorManager.assertRightTuple(BehaviorManager.java:88)
> at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:186)
> at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
> at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
> at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:337)
> at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:184)
> at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1093)
> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1044)
> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:829)
> at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:233)
> at com.company.RuleFlowTest.pepPostEvent(RuleFlowTest.java:83)
--
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