java.io.NotSerializableException: org.activiti.bpmn.model.BpmnModel

hi
I use redis store processDefinitionCache, My flowable.cfg.xml like this



ShareniuDeploymentCache:
Jedis jedis=new Jedis(“127.0.0.1”,6379);
public ProcessDefinitionCacheEntry get(String id) {
Object object = cache.get(id);
if (object !=null) {
jedis.set(id.getBytes(), ObjectToArrayUtils.toByteArray(object));
}
System.out.println(id);
return null;
}
error message:
java.io.NotSerializableException: org.activiti.bpmn.model.BpmnModel
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at com.shareniu.shareniu_activiti6.ch2.ObjectToArrayUtils.toByteArray(ObjectToArrayUtils.java:17)

That’s indeed currently not possible. Making the BpmnModel Serializable is not enough, as the behaviour (and to a lesser extent, the EventSupport with EvenListeners) is stored in the BpmnModel too. A lookup should be needed when that is null … but that logic is currently in the parser logic…

Anyway, I saw you created an issue (https://github.com/flowable/flowable-engine/issues/481), we’ll look into it and discuss it there. Thanks for reporting!