Null Pointer exception while running Kafka Plugin application inside a Docker container

Null Pointer exception while running Kafka Plugin application inside a Docker container

book

Article ID: KB0082001

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for Apache Kafka 6.x

Description

While running a Kafka Plugin application inside a Docker container a null pointer exception occurs, the exception trace looks like something below.
---------------------------------------------------------------------------------------------------------------------
16:51:54.025 ERROR [Thread-32] com.tibco.thor.frwk - Uncaught Throwable
[java.lang.NullPointerException] detected in thread [Thread-32(73)]
java.lang.NullPointerException: null
at
org.apache.kafka.common.requests.MetadataResponse.<init>(MetadataResponse.java:130)
~[kafka-clients-0.9.0.0.jar:na]
at
org.apache.kafka.clients.consumer.internals.Fetcher.getTopicMetadata(Fetcher.java:203)
~[kafka-clients-0.9.0.0.jar:na]
at
org.apache.kafka.clients.consumer.KafkaConsumer.partitionsFor(KafkaConsumer.java:1143)
~[kafka-clients-0.9.0.0.jar:na]
at
com.tibco.bw.palette.kafka.runtime.pojo.receiver.ReceiverMessage.run(ReceiverMessage.java:88)
~[bundleFile:na]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_121
---------------------------------------------------------------------------------------------------------------------

The above exception is thrown by the fetcher class and it generally happens when the Kafka Plugin application is unable to reach the Kafka broker. When defining the value of the Bootstrap server URL for the Kafka Connection resource if the value for the hostname is passed as 'localhost' the above exception will occur.

Issue/Introduction

Null Pointer exception while running Kafka Plugin application inside a Docker container.

Environment

Docker, BWCE

Resolution

In order to resolve this issue provide IP address of the host system where the Kafka Broker is running in the Bootstrap URL field in Kafka Connection Resource.

Ex: 10.108.80.112:9092