2

When I run the Kafka native Message Hub sample code from https://github.com/ibm-messaging/message-hub-samples I get the following exception:

Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to construct kafka producer
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:320)
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:180)
    at com.example.ProducerRunnable.<init>(ProducerRunnable.java:44)
    at com.example.KafkaNativeSample.createMessageProducer(KafkaNativeSample.java:113)
    at com.example.KafkaNativeSample.main(KafkaNativeSample.java:65)
Caused by: org.apache.kafka.common.KafkaException: org.apache.kafka.common.KafkaException: java.io.FileNotFoundException: 
    at org.apache.kafka.common.network.SSLChannelBuilder.configure(SSLChannelBuilder.java:45)
    at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:49)
    at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:79)
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:270)
    ... 4 more
Caused by: org.apache.kafka.common.KafkaException: java.io.FileNotFoundException: 
    at org.apache.kafka.common.security.ssl.SSLFactory.configure(SSLFactory.java:99)
    at org.apache.kafka.common.network.SSLChannelBuilder.configure(SSLChannelBuilder.java:41)
    ... 7 more
Caused by: java.io.FileNotFoundException: 
    at java.io.FileInputStream.<init>(FileInputStream.java:156)
    at java.io.FileInputStream.<init>(FileInputStream.java:111)
    at org.apache.kafka.common.security.ssl.SSLFactory$SecurityStore.load(SSLFactory.java:201)
    at org.apache.kafka.common.security.ssl.SSLFactory$SecurityStore.access$000(SSLFactory.java:186)
    at org.apache.kafka.common.security.ssl.SSLFactory.createSSLContext(SSLFactory.java:123)
    at org.apache.kafka.common.security.ssl.SSLFactory.configure(SSLFactory.java:97)
    ... 8 more

What file is missing?

RandalAnders
  • 1,431
  • 8
  • 15
SimonGormley
  • 182
  • 8

1 Answers1

3

The example resources/consumer.properties and resources/producer.properties files need editing to specify the location of the JRE certificate authority store and it's password.

For example, using the default JRE store:

ssl.truststore.location=C:\\Java80\\jre\\lib\\security\\cacerts
ssl.truststore.password=changeit
SimonGormley
  • 182
  • 8