0

My project using application.yml to store properties.

spring:

  profiles: local
  
  kerberos:
  
    truststore:
  
      key: truststore.jks
  
      file: kafkatool-qa\\truststore.jks
  
    keytab:
  
      key: krb5.keytab
  
      file: kafkatool-qa\\krb5.keytab

The truststore and krb5.keytab are located at "C:\Users\Documents\producers\kafkatool-qa\krb5.keytab". producers\ is my project directory.

When I run the app locally, it can located the 2 files and works. But when I run this app on cloud foundry. It cannot located the file.

Is there anyway to let the app address the krb5.keytab and truststore.jks when it runs on cloud foundry?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Henry Bai
  • 367
  • 1
  • 3
  • 17
  • Can I just set their paths as '{user.home}\kafkatool-qa\krb5.keytab'? – Henry Bai Apr 27 '22 at 22:32
  • Sure, you could, but what is `user.home` in cloud foundry? You have to upload the files there, and it's not really clear how you're doing that (your C drive doesn't exist there). What is `kafkatool-qa`? – OneCricketeer Apr 28 '22 at 14:11
  • @OneCricketeer kafkatool-qa is just a folder where I keep the files the code will reference – Henry Bai Apr 28 '22 at 16:16
  • Okay, and how does that get into cloud foundry? And last I checked, that uses Linux containers so those slashes need reversed, and should only be one. Forward slashes are only for Windows paths. Much of this was already [answered already](https://stackoverflow.com/a/72029231/2308683), but you have not told us how files get **uploaded** to the remote server. – OneCricketeer Apr 28 '22 at 16:51
  • @OneCricketeer I uploaded file by package a jar with maven->login to cloud foundry in intellij terminal->cf push the jar file with java buildpack. Thanks I will try to reverse the slashes in the path. – Henry Bai Apr 28 '22 at 18:02
  • Have you tried building the container _locally_ (e.g. `mvn spring-boot:build-image`) and running that with `docker run`? – OneCricketeer Apr 28 '22 at 18:13

0 Answers0