Well, after trying and trying to reproduce with a simpler case, @role is always correctly
inherited.
But in my application, it seems not, or may be it is another problem.
I have 3 classes : ChantierEvent (the main mother class) and its 2 subClasses : InitEvent
and DisposeEvent
When I declare @role(event) for all 3 classes, everything works wells
When I only declare for the motherclass, this exception is raised (at insertion of a
InitEvent) :
java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be cast to
org.drools.common.EventFactHandle
at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:316)
at
org.drools.rule.VariableRestriction.isAllowedCachedRight(VariableRestriction.java:122)
at org.drools.rule.VariableConstraint.isAllowedCachedRight(VariableConstraint.java:121)
at
org.drools.common.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:208)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:158)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
--> call of insert(new InitEvent(...));
at com.sncf.morse.server.MVFusionThreadSession.addEvent(MVFusionThreadSession.java:158)
I first think about a problem on "after" operator, so I commented out the rule
that uses it, and this error is raised then (I also use sliding windows) :
java.lang.ClassCastException: org.drools.common.DefaultFactHandle cannot be cast to
org.drools.common.EventFactHandle
at org.drools.rule.SlidingTimeWindow.updateNextExpiration(SlidingTimeWindow.java:211)
at org.drools.rule.SlidingTimeWindow.assertRightTuple(SlidingTimeWindow.java:128)
at org.drools.rule.BehaviorManager.assertRightTuple(BehaviorManager.java:84)
at org.drools.reteoo.NotNode.assertObject(NotNode.java:114)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
--> call of insert(new InitEvent(...));
at com.sncf.morse.server.MVFusionThreadSession.addEvent(MVFusionThreadSession.java:158)
Do you have any ideas on why this could happend ?
In what case the role could not be inherited (I tried to make my minimal sample class look
like the real one, but I can't reproduce ..).
thanks