2
votes

I am working with Spring Boot and have a requirement to interact with a legacy app using a .dll file.

The .dll file requires a configuration file which has to be in a physical location like C:/...

The .dll can only read only from a physical location; not like a relative path from the src folder.

I am able to successfully interact with the legacy app in localhost with the configuration file located in C:/, but when I have to deploy in PCF is there any possibility to read the configuration file from a physical directory location in PCF? Like in WAS we can upload a file in the server and use its physical location in the code, can something like this be done in PCF?

2

2 Answers

2
votes

You cannot upload files out of band or in advance of running your app. A fresh container is created for you every time you start/stop/restart your application.

As already mentioned, you can bundle any files you require with your application. That's an easy way to make them available. An alternative would be to have your app download the files it needs from somewhere when the app starts up. Yet another option would be to create a build pack and have it install the file, although this is more work so I would suggest it unless you're trying to use the same installed files across many applications.

As far as referencing files, your app has access to the full file system in your container. Your app runs as the vcap user though, so you will have limited access to where you can read/write based on your user permissions. It's totally feasible to read and write to your user's home directory though, /home/vcap. You can also reference files that you uploaded with your app. Your app is located at /home/vcap/app, which is also the $HOME environment variable when your app runs.

Having said all that, the biggest challenge is going to be that you're trying to bundle and use a .dll which is a Windows shared library with a Java app. On Cloud Foundry, Java apps only run on Linux Cells. That means you won't really be able to run your shared library unless you can recompile it as a linux shared library.

Hope that helps!

0
votes

if both are spring boot jars, you can access them using BOOT-INF/classes/..

just unzip your jar and look for that config file and put up the address

once the jar is exploded in PCF, this hierarchy is maintained