[rules-users] java.lang.ClassCastException: org.drools.reteoo.BetaMemory cannot be cast to org.drools.reteoo.AlphaNode$AlphaMemory

dcrissman dcrissman at redhat.com
Thu May 2 10:20:57 EDT 2013


Yes, I am getting this exception (sadly, not something that I am just worried
about).

I am checking for rule complication errors before running the rules, and no
errors are being given.

I am not dynamically adding or removing rules once I have my knowledge base
setup, it does not change though the duration of the run.

I am using a StatefulKnowledgeSession, and I make sure that after each run
that I am calling dispose in a finally block. So shouldn't be any strange
memory issues.

To add to the original description, I am getting these exceptions in my unit
tests. There is one unit test suite that when disabled the exception goes
away, but when enabled the exceptions happen in other suites. Which of
course is odd and led me to believe that there is a problem with the unit
tests (which is still not ruled out). But the suites are using different
sessions, same rules, but totally different instances of everything.

The only thing I am doing that may be a little funny is consolidating a
collection of objects into one then retracting the collection, but when I
comment out this rule I still am getting this exception. Aside from this one
case, I am not doing anything crazy.

[code]
//ArrayList provided by drools seems to dynamically adjust with the
retractions, this safeguards us against that.
ArrayList safetyArr = new ArrayList($attrs);

ArrayList values = new ArrayList();
for (int i=0; i < safetyArr.size(); i++){
	Attribute attr = ((Attribute) safetyArr.get(i));
	values.add(attr.getValue());
	retract(attr);
}

insert(newAttribute($redHatName, StringUtils.join(values, ",")));
[/code]

Any other thoughts you may have would be appreciated.

Thanks!


Davide Sottara wrote
> The original thread was for a bug in 5.0.x, fixed in 5.1, but it would be
> a
> very serious issue in 5.5. It basically means that the local memory of a
> beta node has been assigned to an alpha node, or that the wrong memory had
> been retrieved. In any case, the rete is broken: wrong facts or types
> would
> be joined in a different order or way than stated by the rules.
> 
> Is this something you're experiencing , or just worried that it may
> happen?
> 
> Causes could be an invalid rule in the first place (running the engine
> without checking for compilation errors), a bug in the construction
> process
> (unlikely, unless the rule is a very rare edge case), or a complex
> scenario
> where you add and remove rules dynamically from a knowledge base.
> On May 1, 2013 2:25 PM, "dcrissman" &lt;

> dcrissman@

> &gt; wrote:
> 
>> Could you explain what you mean by rete corruption? I am familiar with
>> rete,
>> but hardly an expert. I am not really doing anything too complicated, I
>> guess some runtime inserts and retracts.
>>
>> I tried 6.0.0.Beta2, but that has more api changes then I am prepared to
>> handle, I'll wait until the Final version.
>>
>> As for 5.6.0-SNAPSHOT, I am having trouble pulling it down. I will pick
>> that
>> up tomorrow.
>>
>> In the meantime, any clarification to the rete question would be
>> appreciated.
>>
>> Thanks,
>> Dennis
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/java-lang-ClassCastException-org-drools-reteoo-BetaMemory-cannot-be-cast-to-org-drools-reteoo-AlphaNy-tp4023610p4023612.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> 

> rules-users at .jboss

>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> _______________________________________________
> rules-users mailing list

> rules-users at .jboss

> https://lists.jboss.org/mailman/listinfo/rules-users





--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-ClassCastException-org-drools-reteoo-BetaMemory-cannot-be-cast-to-org-drools-reteoo-AlphaNy-tp4023610p4023630.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list