Question
CGI
SE
Last activity: 27 Oct 2022 13:38 EDT
Getting error in Avro message serialization as unable to set property type as long .
Hi ,
we are getting below error while trying to publish message to Kafka topic .
Conversion of ClipboardPage to GenericRecord has failed. org.apache.kafka.common.errors.SerializationException: Error serializing Avro message Caused by: java.lang.NullPointerException: null of string in field createdBy of xx.xx.xxx.xxx.xxx.xxxx.LoanApplicationDeniedEvent at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:183) ~[avro-1.9.1.jar:?] at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:177) ~[avro-1.9.1.jar:?] at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.1.jar:?]
Avro Schema :
{ "namespace": "xx.xxx.xxx.xxx.xxx.poc", "type": "record", "name": "LoanApplicationDeniedEvent", "doc": "This event is emitted when a loan application is denied after processing.", "fields": [ { "name": "createdAt", "type": "long"}, { "name": "CaseId", "type": "string"}, { "name": "createdBy", "type": "string", "doc": "The user (human or system) that has denied the loan application" }, { "name": "reason", "type": "string", "doc": "A description of why the loan application was denied" } ] }
Hi ,
we are getting below error while trying to publish message to Kafka topic .
Conversion of ClipboardPage to GenericRecord has failed. org.apache.kafka.common.errors.SerializationException: Error serializing Avro message Caused by: java.lang.NullPointerException: null of string in field createdBy of xx.xx.xxx.xxx.xxx.xxxx.LoanApplicationDeniedEvent at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:183) ~[avro-1.9.1.jar:?] at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:177) ~[avro-1.9.1.jar:?] at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:82) ~[avro-1.9.1.jar:?]
Avro Schema :
{ "namespace": "xx.xxx.xxx.xxx.xxx.poc", "type": "record", "name": "LoanApplicationDeniedEvent", "doc": "This event is emitted when a loan application is denied after processing.", "fields": [ { "name": "createdAt", "type": "long"}, { "name": "CaseId", "type": "string"}, { "name": "createdBy", "type": "string", "doc": "The user (human or system) that has denied the loan application" }, { "name": "reason", "type": "string", "doc": "A description of why the loan application was denied" } ] }
There is no way to create property type as long in pega , so i tried creating createdAt property as : Double , Integer but got the above serialization error . Even though Data-Set execute step page the
createdAt property has value (not null).
Any help would be highly appreciated .
Thanks,
Abhishek