I have written my own serialiser to publish a java object to a topic. I set the serializer.class property to my custom serialiser. When running the producer i get following exception. Can someone help me out?
exception
Exception in thread "main" java.lang.NoSuchMethodException: com.xxxx.CustomFileSerializer.<init>(kafka.utils.VerifiableProperties)
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getConstructor(Class.java:1825)
at kafka.utils.CoreUtils$.createObject(CoreUtils.scala:222)
at kafka.producer.Producer.<init>(Producer.scala:62)
at kafka.javaapi.producer.Producer.<init>(Producer.scala:26)
at com.xx.KafkaProducer.generateMessgaes(KafkaProducer.java:50)
at com.xx.KafkaProducer.main(KafkaProducer.java:60)
My producer
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("serializer.class", "com.xxxx.CustomFileSerializer");
kafka.javaapi.producer.Producer<String, FileObj> producer = new kafka.javaapi.producer.Producer<String, FileObj>(
producerConfig);
String key = "key1";
KeyedMessage<String, RawFile> record = new KeyedMessage<String, RawFile>(topic, key, file);
producer.send(record);
producer.close();