Starting with DSpace 10, the Replication Task Suite event consumers fail at runtime with a NoSuchMethodError whenever a Community/Collection/Item event is dispatched (e.g. installing or modifying an item). This makes the automatic replication consumer unusable on DSpace 10.
Root cause
DSpace 10 changed the org.dspace.event.Event API (PR DSpace/DSpace#11072 – "REST: Audit Trail feature", milestone 10.0). The event "detail" is now modelled by a new org.dspace.event.EventDetail type:
- public EventDetail getDetail() now returns an EventDetail (see Event.java, and getDetailList()).
- The previous public String getDetail() no longer exists.
The consumers in this add-on still call Event.getDetail() expecting a String (the object handle). Since that method signature was removed, the JVM
throws NoSuchMethodError.
Affected classes:
- org.dspace.ctask.replicate.BagItReplicateConsumer (e.g. String id = event.getDetail(); in consume(...))
- org.dspace.ctask.replicate.METSReplicateConsumer (several usages: CREATE/INSTALL, REMOVE/DELETE, ADD, and event.getDetail().equals(id))
To Reproduce:
-
Deploy the Replication Task Suite on a DSpace 10 instance.
-
Enable the replicate consumer in dspace.cfg:
event.consumer.replicate.class = org.dspace.ctask.replicate.BagItReplicateConsumer
event.consumer.replicate.filters = Community|Collection|Item+Install|Modify|Modify_Metadata|Delete
event.dispatcher.default.consumers = ..., replicate
-
Create or modify an item (e.g. a metadata PATCH via REST).
-
The commit fails with the NoSuchMethodError above.
Expected behavior
The consumers should obtain the object identifier via the new EventDetail API and work on DSpace 10.
Proposed fix
Replace the event.getDetail() (String) usages with the new API, e.g. extract the underlying value from the EventDetail:
EventDetail detail = event.getDetail();
String id = (detail != null && detail.getDetailObject() != null)
? detail.getDetailObject().toString() : null;
This needs to be applied to both BagItReplicateConsumer and METSReplicateConsumer.
Starting with DSpace 10, the Replication Task Suite event consumers fail at runtime with a NoSuchMethodError whenever a Community/Collection/Item event is dispatched (e.g. installing or modifying an item). This makes the automatic replication consumer unusable on DSpace 10.
Root cause
DSpace 10 changed the org.dspace.event.Event API (PR DSpace/DSpace#11072 – "REST: Audit Trail feature", milestone 10.0). The event "detail" is now modelled by a new org.dspace.event.EventDetail type:
The consumers in this add-on still call Event.getDetail() expecting a String (the object handle). Since that method signature was removed, the JVM
throws NoSuchMethodError.
Affected classes:
To Reproduce:
Deploy the Replication Task Suite on a DSpace 10 instance.
Enable the replicate consumer in dspace.cfg:
event.consumer.replicate.class = org.dspace.ctask.replicate.BagItReplicateConsumer
event.consumer.replicate.filters = Community|Collection|Item+Install|Modify|Modify_Metadata|Delete
event.dispatcher.default.consumers = ..., replicate
Create or modify an item (e.g. a metadata PATCH via REST).
The commit fails with the NoSuchMethodError above.
Expected behavior
The consumers should obtain the object identifier via the new EventDetail API and work on DSpace 10.
Proposed fix
Replace the event.getDetail() (String) usages with the new API, e.g. extract the underlying value from the EventDetail:
This needs to be applied to both BagItReplicateConsumer and METSReplicateConsumer.