In my property file I have
spring.kafka.ssl.key-store-location=${javax.net.ssl.keyStore:}
Operations confirmed that -Djavax.net.ssl.keyStore=/opt/app/config/keystore.jks
is being called to start Tomcat.
Just to verify I added
@Value('${javax.net.ssl.keyStore:}')
String keystore
@Value('${spring.kafka.ssl.key-store-location:}')
String springKeystore
to one of my components and confirmed that the values are /opt/app/config/keystore.jks
But the app errors out with
org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
Caused by: org.apache.kafka.common.KafkaException: Failed to load SSL keystore /opt/app/webapps/ROOT/opt/app/config/keystore.jks of type JKS
Caused by: java.nio.file.NoSuchFileException: /opt/app/webapps/ROOT/opt/app/config/keystore.jks
I confirmed that /opt/app/webapps/ROOT
is where the war is exploded. So I am confused as to why the war file location is being prefixed to the keystore location when autoconfiguring the Kafka client.