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.