shikhar / kafka-connect-dynamodb

Kafka Connector for DynamoDB
Apache License 2.0
34 stars 50 forks source link

Java null pointer exception when deleting items from table #15

Open wenyaowu opened 7 years ago

wenyaowu commented 7 years ago

I'm using source connector for my dynamo table. There are no problems until I delete an item from the table, and this is what I got when I delete the item: 2017-05-01 14:12:28,609] ERROR Task dynamodb-source-test-0 threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:141) java.lang.NullPointerException at dynamok.source.RecordMapper.toConnect(RecordMapper.java:57) at dynamok.source.DynamoDbSourceTask.toSourceRecord(DynamoDbSourceTask.java:120) at dynamok.source.DynamoDbSourceTask.lambda$poll$9(DynamoDbSourceTask.java:110) at dynamok.source.DynamoDbSourceTask$$Lambda$18/1910327716.apply(Unknown Source) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at dynamok.source.DynamoDbSourceTask.poll(DynamoDbSourceTask.java:111) at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:162) at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:139) at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:182) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

I'm wondering if the connector is trying to get attributes from NewImage but NewImage is null when deleting an item from the pointer so it keeps throwing NullPointer exception.

anupkumarsharma commented 6 years ago

Checkout this pull- https://github.com/shikhar/kafka-connect-dynamodb/pull/20