Ok, so there are two main possibilities.. either the locking mechanism does not work appropriately and there is a concurrency issue, or the particular rule structure exposes an edge case in node comparison and reuse. The former is more probable, but should be relatively easy to see. I need your help in testing this in the production environment where you get the exception.
You should essentially add a org.drools.event.knowledgebase.KnowledgeBaseEventListener to the knowledge base : kb.addEventListener( new MyLoggingKBEventListener() ); and provide an implementation that suitably logs which thread is executing which action. The KnowledgeBaseEventListener is an interface with methods such as: void beforeKnowledgeBaseLocked(BeforeKnowledgeBaseLockedEvent event); void afterKnowledgeBaseLocked(AfterKnowledgeBaseLockedEvent event); void beforeRuleAdded(BeforeRuleAddedEvent event); void afterRuleAdded(AfterRuleAddedEvent event); etc... Can you try this solution? Thanks! Davide On 05/08/2013 10:57 AM, mohdejaz74 wrote: > I use KB methods directly > > For adding/updating a rule, I create a temporary instance of > KnowledgeBuilder and add the rule to check if there are any errors. > > If there are no errors, I first remove (if rule needs to be updated) the > previous rule by calling this ... > > kb.removeRule(ro.pkg, ro.name); > > Then I add the new rule ... > > kb.addKnowledgePackages(kbuilder.getKnowledgePackages()); > > Ejaz > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/threw-error-java-lang-ClassCastException-org-drools-reteoo-FromNode-FromMemory-cannot-be-cast-to-orgy-tp4023497p4023733.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
