[rules-users] ClassCastException using WorkingMemoryFileLogger (3.0.6)

Yuri de Wit ydewit at gmail.com
Tue Jun 19 22:03:40 EDT 2007


I got a ClassCastException once I ran my app with the
WorkingMemoryFileLogger attached to it. After a bit of debugging the
CCE is being thrown because for an unknown reason the column of a
Declaration is wrong: it should have been 0 like all the other
declarations on the same Fact, but it is 0 instead. It seems that
column is wrongly set when building the rule package, even before
evaluating.

What I dont understand is why this is happening and why I dont see the
problem when I remove the WorkingMemoryFileLogger from the picture.

The rules goes a bit like this:

rule
     when
           Fact1(var1: a, var2: b, var3: c)

           c : (
              Setting( x==1, y==2, z==3)
            or
               Setting( x==1, y==2, z==ANY)
            or
               Setting( x==1, y==ANY, z==ANY)
            or
               Setting( x==ANY, y==ANY, z==ANY)
           )

           not Fact2( a == var1, b== var2, c==var3)
     then
           ...
end

The declarations for a and b, for instance are referring to the right
column, but c doesnt.

BTW: Does any one know of a better pattern for implementing cascading
settings? The biggest problem I am facing is that I need to replicate
the long list or OR Settings for each rule that needs to check for
them (the actual settings depend on fact properties).

Here is the exception:

org.drools.spi.ConsequenceException: java.lang.ClassCastException: com....
        at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:441)
        at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:407)
        at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:268)
        at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:255)



More information about the rules-users mailing list