【发布时间】:2020-05-19 18:49:20
【问题描述】:
我的设置:
- JDK 11.0.6
- Spring Boot 2.2.4.RELEASE
- spring-kafka 2.4.1
我已经在 PLAINTEXT 中验证了我的 Zookeeper / Kafka / 客户端应用程序,一切正常。我还使用 Kafka 客户端工具验证了我的密钥库/信任库。
我正在使用 KafkaAdmin bean 来配置我的主题,它似乎在 SSL 连接上失败了:
@Bean
public KafkaAdmin kafkaAdmin() {
Map<String, Object> configs = new HashMap<>();
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, getKafkaHost());
configs.put("security.protocol", "SSL");
configs.put("ssl.key.password", "xxx");
configs.put("ssl.keystore.location", "/keystore/client.keystore.jks");
configs.put("ssl.keystore.password", "xxx");
configs.put("ssl.truststore.location", "/keystore/kafka.truststore.jks");
configs.put("ssl.truststore.password", "xxx");
return new KafkaAdmin(configs);
}
我的两个 JKS 文件位于我的项目的 src/main/resources/keystore 中。 /keystore 不起作用...如果我指定/src/main/resources/keystore/client.keystore.jks,它们似乎会被捡起...这在现实世界中会起作用吗?在独立的 tomcat 运行时,会有一个 /src/main/resources/keystore?
据我了解,路径是相对于 target/classes 文件夹的,不是吗?
【问题讨论】:
标签: java spring spring-boot ssl apache-kafka