[rules-users] WorkingMemory problem when reading using ObjectInputStream (Drools 4.0.7)
Przemysław Różycki
P.Rozycki at amg.net.pl
Tue Jan 20 04:54:33 EST 2009
Rafael Felini wrote:
> Hi Przemysław,
>
> I am using Drools BRMS and I had this error when the Facts Models
> deployed in BRMS isn't up to date with the source code or vice -versa.
>
> Perhaps, your WorkingMemory was serialized using another version of
> your Model.
>
> Best regards,
> --
> Rafael Felini.
Hi Rafael,
thanks for your response. Was yor stack trace the same as mine or just
similair? I don't think my model is not up to date. The attached example
is very simple and I don't think the model matters in it's case. I don't
know if you tried to run it (it's really simple application), but I
think the problem is reproducible in 100%.
BTW, I was going on with my research about this issue and I followed my
stack trace, looked at Rete.java, line 605 and found that it belongs to
the method
private void readObject(ObjectInputStream stream)
and contains code:
this.ruleBase = ((DroolsObjectInputStream) stream).getRuleBase();
And... now it's clear where the ClassCastException comes from. I don't
think it's a good practice to require that deserialization is done with
some special input stream. Everyting is fine when you use just Drools
components, like BRMS or when you control 100% of your code. But I want
to place my working memory in BEA Weblogic's JNDI and it uses just
ObjectInputStream to read the serialized object and I can't change it.
Documentation says that working memory is serializable and there
souldn't be any problem with operations like placing it in JNDI and
Drools API docs does not mention anything about the requirement of using
DroolsObjectInputStream. That's why I think, it's a bug.
I'm thinking about any workaround. Does anyone know if JBoss Cache has
any problems with containing StatefulSession object?
Best regards,
Przemek
More information about the rules-users
mailing list