[jboss-user] [jBPM] - persisted stateful sessions and knowledge base changes

Jordi Alvarez do-not-reply at jboss.com
Mon Sep 26 12:31:09 EDT 2011

Jordi Alvarez [http://community.jboss.org/people/jordi_alvarez] created the discussion

"persisted stateful sessions and knowledge base changes"

To view the discussion, visit: http://community.jboss.org/message/628586#628586

Hello, I am working for an organization for which we have adopted jBPM as the BPM solution. We are making use also of Drools
Expert, which results in a nice combination.

We have stateful sessions persisted in a database in order to record the state of long-time running processes (which are the goal of our

In order to make changes to the knowledge-base associated to the stateful sessions that we have, we always redeploy the whole system (ear application + rules + process definitions). This is where we have the problem. Depending on the changes performed to the database, the system is not able to reload the persisted sessions (the change could be for example a change in the condition of a rule). This results in problems and stack traces similar to the following one:

Caused by: java.lang.RuntimeException: Unable to load session snapshot
at org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:96)
at org.drools.persistence.session.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:196)
at org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:159)
... 95 more
Caused by: java.lang.ClassCastException: org.drools.reteoo.ObjectTypeNode
at org.drools.marshalling.impl.InputMarshaller.readRightTuple(InputMarshaller.java:401)
at org.drools.marshalling.impl.InputMarshaller.readRightTuples(InputMarshaller.java:391)
at org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:326)
at org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:205)
at org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:91)
at org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:91)
... 97 more

According to some posts (which mainly relate to drools expert), if we were using the knowledge agent we could update the already loaded sessions, which would allow to migrate in-memory sessions from the old database to the new database: 

 http://drools.46999.n3.nabble.com/Dynamic-updates-of-stateful-sessions-td2834623.html http://drools.46999.n3.nabble.com/Dynamic-updates-of-stateful-sessions-td2834623.html
 http://stackoverflow.com/questions/4368148/is-it-possible-to-add-a-new-rule-to-a-running-drools-session http://stackoverflow.com/questions/4368148/is-it-possible-to-add-a-new-rule-to-a-running-drools-session

Nevertheless, we absolutely need a way to migrate persisted sessions from the old database to the new one. Even in the situation in which we would allow hot modification of the knowledge base, we cannot have all the stateful sessions loaded in memory when this would happen.
Is there any facility provided by Drools Expert/Flow that allows to perform this operations easily? Is there a way/configuration to
load/save sessions without the need to store/retrieve the rete-tree (and instead recomputing it), which seems to be the problem for these

We have already posted this information into drools mailing list; but nobody has answered yet. Any help is appreciated!

Many thanks in advance,
Jordi Alvarez


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110926/850a42e9/attachment.html 

More information about the jboss-user mailing list