Closed roshankhadkahp closed 1 year ago
Configuration: public KryoSerDes(Class clazz) { this.clazz = clazz; this.kryo = new Kryo(); kryo.setReferences(true); kryo.setRegistrationRequired(false); kryo.setWarnUnregisteredClasses(true); kryo.setOptimizedGenerics(false); this.kryo.register(clazz); this.kryo.register(Long.class); this.kryo.register(Integer.class); this.kryo.register(Double.class); this.kryo.register(Collection.class); this.kryo.register(Map.class); kryo.register(ArrayList.class); kryo.register(LinkedList.class); kryo.register(HashSet.class); kryo.register(TreeSet.class); kryo.register(Hashtable.class); kryo.register(Date.class); kryo.register(Calendar.class); kryo.register(ConcurrentHashMap.class); kryo.register(SimpleDateFormat.class); kryo.register(GregorianCalendar.class); kryo.register(Vector.class); kryo.register(BitSet.class); kryo.register(StringBuffer.class); kryo.register(StringBuilder.class); kryo.register(Object.class); kryo.register(Object[].class); kryo.register(LinkedHashMap.class); kryo.register(String.class); kryo.register(String[].class); kryo.register(Character.class); kryo.register(Character[].class); this.kryo.register(List.of("").getClass(), new DefaultSerializers.ArraysAsListSerializer()); this.kryo.register(Collections.EMPTY_LIST.getClass(), new DefaultSerializers.CollectionsEmptyListSerializer()); this.kryo.register(Collections.EMPTY_MAP.getClass(), new DefaultSerializers.CollectionsEmptyMapSerializer()); this.kryo.register(Collections.EMPTY_SET.getClass(), new DefaultSerializers.CollectionsEmptySetSerializer()); this.kryo.register(Collections.singletonList("").getClass(), new DefaultSerializers.CollectionsSingletonListSerializer()); this.kryo.register(Collections.singleton("").getClass(), new DefaultSerializers.CollectionsSingletonSetSerializer()); this.kryo.register(Collections.singletonMap("", "").getClass(), new DefaultSerializers.CollectionsSingletonMapSerializer()); this.kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer()); this.kryo.register(InvocationHandler.class, new JdkProxySerializer()); UnmodifiableCollectionsSerializer.registerSerializers(kryo); SynchronizedCollectionsSerializer.registerSerializers(kryo); ListSerializer.registerSerializers(kryo); MapSerializer.registerSerializers(kryo); SetSerializer.registerSerializers(kryo); this.kryo.register(BootstrapperFeedWrapper.class); this.kryo.register(AudiencePushWrapper.class); this.kryo.register(DBAudienceFetcherMessage.class); this.kryo.register(DBFetcherMessage.class); this.kryo.register(DeliveryCountMessage.class); this.kryo.register(PushchimpDeliveryMessage.class); this.kryo.register(SegmentCountMessage.class); this.kryo.register(UserListProcessorFeed.class); this.kryo.register(UserTagListPushMessage.class); this.kryo.register(UserTagPushMessage.class); this.kryo.register(com.hamropatro.model.Campaign.class); this.kryo.register(DeliveryStatus.class); this.kryo.register(Payload.class); this.kryo.register(CampaignType.class); this.kryo.register(GeneralPush.class); this.kryo.register(AudiencePushRequest.Priority.class); this.kryo.register(Platform.class); this.kryo.register(ServiceMessage.class); this.kryo.register(MiniApp.class); this.kryo.register(ServiceMessageButton.class); this.kryo.register(ServiceMessageField.class); this.kryo.register(DBServiceMessage.MediaSize.class); this.kryo.register(ServiceMessageMedia.class); this.kryo.register(SMS.class); this.kryo.register(Segment.class); this.kryo.register(Condition.class); this.kryo.register(SegmentConditions.class); this.kryo.register(SegmentCondition.class); this.kryo.register(SegmentCondition.Operator.class); this.kryo.register(AudienceDTO.class); this.kryo.register(UserListItem.class); this.kryo.register(MessageCount.class); this.kryo.register(TagList.class); this.kryo.register(TagConditions.class); this.kryo.register(TagCondition.class); this.kryo.register(TagCondition.Operator.class); this.kryo.register(TagCondition.Type.class); }
UserListProcessorFeed: @Data @AllArgsConstructor @NoArgsConstructor public class UserListProcessorFeed{ private long userListId; private UserListItem userListItem; private Campaign campaign; private String campaignName; private String batch; private boolean dryRun; private Map<String,String> metadata;
}
Error: 12:07:21.250 [pool-1-thread-13] ERROR com.hamropatro.serdes.KryoSerDes - Error occurred in deserialization: Unable to resolve reference for String with id: 11 Serialization trace: campaignName (com.hamropatro.dto.UserListProcessorFeed) 12:07:21.251 [pool-1-thread-14] ERROR com.hamropatro.serdes.KryoSerDes - Error occurred in deserialization: Unable to resolve reference for String with id: 11 Serialization trace: campaignName (com.hamropatro.dto.UserListProcessorFeed)
@roshankhadkahp: Please provide a simple unit test that reproduces your issue.
Configuration: public KryoSerDes(Class clazz) {
this.clazz = clazz;
this.kryo = new Kryo();
kryo.setReferences(true);
kryo.setRegistrationRequired(false);
kryo.setWarnUnregisteredClasses(true);
kryo.setOptimizedGenerics(false);
this.kryo.register(clazz);
this.kryo.register(Long.class);
this.kryo.register(Integer.class);
this.kryo.register(Double.class);
this.kryo.register(Collection.class);
this.kryo.register(Map.class);
kryo.register(ArrayList.class);
kryo.register(LinkedList.class);
kryo.register(HashSet.class);
kryo.register(TreeSet.class);
kryo.register(Hashtable.class);
kryo.register(Date.class);
kryo.register(Calendar.class);
kryo.register(ConcurrentHashMap.class);
kryo.register(SimpleDateFormat.class);
kryo.register(GregorianCalendar.class);
kryo.register(Vector.class);
kryo.register(BitSet.class);
kryo.register(StringBuffer.class);
kryo.register(StringBuilder.class);
kryo.register(Object.class);
kryo.register(Object[].class);
kryo.register(LinkedHashMap.class);
kryo.register(String.class);
kryo.register(String[].class);
kryo.register(Character.class);
kryo.register(Character[].class);
this.kryo.register(List.of("").getClass(), new DefaultSerializers.ArraysAsListSerializer());
this.kryo.register(Collections.EMPTY_LIST.getClass(), new DefaultSerializers.CollectionsEmptyListSerializer());
this.kryo.register(Collections.EMPTY_MAP.getClass(), new DefaultSerializers.CollectionsEmptyMapSerializer());
this.kryo.register(Collections.EMPTY_SET.getClass(), new DefaultSerializers.CollectionsEmptySetSerializer());
this.kryo.register(Collections.singletonList("").getClass(), new DefaultSerializers.CollectionsSingletonListSerializer());
this.kryo.register(Collections.singleton("").getClass(), new DefaultSerializers.CollectionsSingletonSetSerializer());
this.kryo.register(Collections.singletonMap("", "").getClass(), new DefaultSerializers.CollectionsSingletonMapSerializer());
this.kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
this.kryo.register(InvocationHandler.class, new JdkProxySerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
ListSerializer.registerSerializers(kryo);
MapSerializer.registerSerializers(kryo);
SetSerializer.registerSerializers(kryo);
this.kryo.register(BootstrapperFeedWrapper.class);
this.kryo.register(AudiencePushWrapper.class);
this.kryo.register(DBAudienceFetcherMessage.class);
this.kryo.register(DBFetcherMessage.class);
this.kryo.register(DeliveryCountMessage.class);
this.kryo.register(PushchimpDeliveryMessage.class);
this.kryo.register(SegmentCountMessage.class);
this.kryo.register(UserListProcessorFeed.class);
this.kryo.register(UserTagListPushMessage.class);
this.kryo.register(UserTagPushMessage.class);
this.kryo.register(com.hamropatro.model.Campaign.class);
this.kryo.register(DeliveryStatus.class);
this.kryo.register(Payload.class);
this.kryo.register(CampaignType.class);
this.kryo.register(GeneralPush.class);
this.kryo.register(AudiencePushRequest.Priority.class);
this.kryo.register(Platform.class);
this.kryo.register(ServiceMessage.class);
this.kryo.register(MiniApp.class);
this.kryo.register(ServiceMessageButton.class);
this.kryo.register(ServiceMessageField.class);
this.kryo.register(DBServiceMessage.MediaSize.class);
this.kryo.register(ServiceMessageMedia.class);
this.kryo.register(SMS.class);
this.kryo.register(Segment.class);
this.kryo.register(Condition.class);
this.kryo.register(SegmentConditions.class);
this.kryo.register(SegmentCondition.class);
this.kryo.register(SegmentCondition.Operator.class);
this.kryo.register(AudienceDTO.class);
this.kryo.register(UserListItem.class);
this.kryo.register(MessageCount.class);
this.kryo.register(TagList.class);
this.kryo.register(TagConditions.class);
this.kryo.register(TagCondition.class);
this.kryo.register(TagCondition.Operator.class);
this.kryo.register(TagCondition.Type.class);
}
UserListProcessorFeed: @Data @AllArgsConstructor @NoArgsConstructor public class UserListProcessorFeed{ private long userListId; private UserListItem userListItem; private Campaign campaign; private String campaignName; private String batch; private boolean dryRun; private Map<String,String> metadata;
}
Error: 12:07:21.250 [pool-1-thread-13] ERROR com.hamropatro.serdes.KryoSerDes - Error occurred in deserialization: Unable to resolve reference for String with id: 11 Serialization trace: campaignName (com.hamropatro.dto.UserListProcessorFeed) 12:07:21.251 [pool-1-thread-14] ERROR com.hamropatro.serdes.KryoSerDes - Error occurred in deserialization: Unable to resolve reference for String with id: 11 Serialization trace: campaignName (com.hamropatro.dto.UserListProcessorFeed)