kafka-jira mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randall Hauch (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KAFKA-6728) Kafka Connect Header Null Pointer Exception
Date Tue, 03 Apr 2018 02:07:00 GMT

    [ https://issues.apache.org/jira/browse/KAFKA-6728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16423380#comment-16423380

Randall Hauch commented on KAFKA-6728:

Added a second PR (see previous message) that attempts to fix the NPE that results from the
Connect worker not instantiating a HeaderConverter when the worker configuration (or connector
configuration) does not specify a {{header.converter}} value and the default is to be used.
In this case, the [Plugins.newHeaderConverter(...)|https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/Plugins.java#L198-L201]
method appears to be an issue: when no {{header.converter}} is specified, the original properties
will not contain the {{header.converter}} key, so the method will always return null.

> Kafka Connect Header Null Pointer Exception
> -------------------------------------------
>                 Key: KAFKA-6728
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6728
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 1.1.0
>         Environment: Linux Mint
>            Reporter: Philippe Hong
>            Priority: Critical
> I am trying to use the newly released Kafka Connect that supports headers by using the
standalone connector to write to a text file (so in this case I am only using the sink component)
> I am sadly greeted by a NullPointerException :
> {noformat}
> ERROR WorkerSinkTask{id=local-file-sink-0} Task threw an uncaught and unrecoverable exception
> java.lang.NullPointerException
>     at org.apache.kafka.connect.runtime.WorkerSinkTask.convertHeadersFor(WorkerSinkTask.java:501)
>     at org.apache.kafka.connect.runtime.WorkerSinkTask.convertMessages(WorkerSinkTask.java:469)
>     at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:301)
>     at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:205)
>     at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:173)
>     at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:170)
>     at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:214)
>     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:1149)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>     at java.lang.Thread.run(Thread.java:748)
> {noformat}
> I launched zookeeper and kafka 1.1.0 locally and sent a ProducerRecord[String, Array[Byte]]
using a KafkaProducer[String, Array[Byte]] with a header that has a key and value.
> I can read the record with a console consumer as well as using a KafkaConsumer (where
in this case I can see the content of the header of the record I sent previously) so no problem
> I only made two changes to the kafka configuration:
>      - I used the StringConverter for the key and the ByteArrayConverter for the value.

>      - I also changed the topic where the sink would connect to.
> If I forgot something please tell me so as it is the first time I am creating an issue
on Jira.

This message was sent by Atlassian JIRA

View raw message