7

i have technical problem trying solving when deploying my app spring boot app with docker container.

org.apache.kafka.common.KafkaException: org.apache.kafka.common.KafkaException: Failed to load SSL keystore /tmp/tomcat-docbase.4737956707529585395.8080/deployments/app/certs/kafka.truststore.jks

/deployments is my workdir configure in dockerfile

i find it strange that it picking on tmp/tomcat docbase because when configuring for other truststore it getting in the correct place. Here what inside my application.yaml

spring:
   kafka:
     bootstrap-servers:localhost:9092
     ssl:
       truststore-location: /deployments/app/certs/kafka-truststore.jks
       truststore-password: test
     consumer:
      group-id: consumerid
server:
   ssl:
    enabled: false
    key-store: /deployments/app/certs/dp--dev.jks
    key-store-password: changeit
    trust-store: /deployments/app/certs/ol-truststore-dev.jks
    trust-store-password: test

it something that i am missing or it relate to kafka springframework lib that i am using ?

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
DarkVision
  • 1,373
  • 3
  • 20
  • 33

1 Answers1

22

The truststore-location is a Spring Resource (classpath: by default) so it looks for the file on the class path. Boot checks the file is present so I don't see how it got past boot without error and gets passed to Kafka (unless it's also on the class path). If Boot finds it ok, Kafka should too.

Try file:/deployments/app/certs/kafka-truststore.jks

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Thats what i was looking for . Thanks – SunilS Aug 22 '19 at 04:56
  • thank you. works. irritatingly all of a sudden a resource file path was being referenced after "/private/var/folders/x1/mzgdrffs2g74z6736y089281m6lxxq/T/tomcat-docbase.8080" in IntelliJ. adding file: solved the issue. – Raj P Dec 21 '21 at 03:13
  • 1
    In my case , it worked like this: file://deployments/app/certs/kafka-truststore.jks – yv84_ Apr 24 '22 at 17:18
  • Thanks Gary. It worked for me. But it took a lot of effort of googling to find this answer. – Rogger296 Aug 03 '22 at 13:05