2015-11-05 44 views
2

當我運行從https://github.com/ibm-messaging/message-hub-samples我得到下面的異常卡夫卡機消息中心的示例代碼:FileNotFoundException異常運行消息中心示例代碼

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 

缺失是什麼文件?

回答

3

示例resources/consumer.propertiesresources/producer.properties需要進行編輯以指定JRE證書頒發機構存儲的位置及其密碼。

例如,使用默認的JRE商店:

ssl.truststore.location=C:\\Java80\\jre\\lib\\security\\cacerts 
ssl.truststore.password=changeit