Jason J [
https://community.jboss.org/people/jasonjho] created the discussion
"jBPM Persistence: Object unmarshalling with Drools accumulate"
To view the discussion, visit:
https://community.jboss.org/message/773261#773261
--------------------------------------------------------------
Environment: Drools 5.3.1 + jBPM5.2
I am using a custom ObjectMarshallingStrategy when using jBPM persistence b/c I am unable
to serialize the Facts that are inserted into the working memory.
To do this, I am plugging in a custom strategy on the persistence environment as such:
env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] {
new MyResolverStrategy(...),
new JPAPlaceholderResolverStrategy(persistenceEnv),
new
SerializablePlaceholderResolverStrategy(ClassObjectMarshallingStrategyAcceptor.DEFAULT)
});
I also have a rule in the ksession that is used to trigger some events in the jBPM
workflow. This rule uses the "collect" feature of Drools and it accumulates
Facts until a condition is met.
$currentApprovals: List(size >= 3) from collect(Approval() from
$document.getCurrentApprovals())
I am getting the following exception
java.io.OptionalDataException: null
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1282)
~[na:1.6.0_31]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
~[na:1.6.0_31]
at
org.drools.marshalling.impl.InputMarshaller.readLeftTuple(InputMarshaller.java:714)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.marshalling.impl.InputMarshaller.readLeftTuple(InputMarshaller.java:619)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.marshalling.impl.InputMarshaller.readLeftTuples(InputMarshaller.java:584)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:433)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:266)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:196)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:93)
~[drools-core-5.3.1.Final-csi.jar:5.3.1.Final]
at
org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:91)
~[drools-jbpm-persistence-jpa-5.3.1.Final-csi.jar:5.3.1.Final]
... 26 common frames omitted
Looking at this code, I see
case NodeTypeEnums.AccumulateNode: {
// accumulate nodes generate new facts on-demand and need special
procedures when de-serializing from persistent storage
AccumulateMemory memory = (AccumulateMemory) context.wm.getNodeMemory(
(BetaNode) sink );
memory.betaMemory.getLeftTupleMemory().add( parentLeftTuple );
readBehaviors( (BetaNode) sink,
memory.betaMemory,
context );
AccumulateContext accctx = new AccumulateContext();
parentLeftTuple.setObject( accctx );
// first we de-serialize the generated fact handle
InternalFactHandle handle = readFactHandle( context );
accctx.result = new RightTuple( handle,
(RightTupleSink) sink );
// then we de-serialize the associated accumulation context
accctx.context = (Serializable[]) stream.readObject();
...
...
It looks like the last line above is doing some deserializing. I am not familiar with
this lower level code, but shouldn't this be using the ObjectMarshallingStrategy? How
will the objects be able to deserialize correctly if I am relying on my own strategy to
resolve facts?
Any help would be appreciated!!
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/773261#773261]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]