1

I am confused, and googled everything but there's no answer:

I got a excel file stored in somewhere like this on windows, it's a shared file under 'Network':

\\[serverName]\[folderName]\[folderName]\[folderName]\[folderName]\ZNAC.XLSX

It's compulsory that I can only read/download the file here. Everything works fine when I am reading it from local, it both works fine by using SMB or declare the file path directly as an inputstream.

But when I deploy to SAP cloud foundry, it always ends up with FileNotFoundException, and I tried a lot of ways and no change.

I am wondering if the cloud instance is finding the file from internally not externally. But I tried SMB as well, it's not working. I found there is something called 'Volume service' on cloud foundry, but it's not usable in SAP Cloud Foundry.

Any help to make my application able to read an external file from SAP Cloud Foundry?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
liu baijun
  • 11
  • 2
  • obviously Cloud Foundry will not be able to read file from your SMB share, dunno why it's a surprise for you – Suncatcher Apr 20 '21 at 10:17
  • @Suncatcher it's the first time i am trying this. well, is there any way i can read the External file? BTW Sap CF do not have NFS/Volume service.... – liu baijun Apr 21 '21 at 07:06

2 Answers2

0

To read a file from an external share you must first create volume service for the corresponding share (NFS or SMB) and start it.

Then you must bind service instance to the CF app like this:

cf bind-service YOUR-APP SERVICE-NAME -c '{"uid":"UID","gid":"GID","mount":"OPTIONAL-MOUNT-PATH","readonly":true}'

The detailed guide is here

https://docs.cloudfoundry.org/devguide/services/using-vol-services.html#smb

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
  • Which is not available on SAP Cloud Platform. SCP is not managed by his organization, but by SAP. – breadcrumb42 Apr 22 '21 at 08:56
  • he didn't specify where he hosts his CF, locally or in cloud – Suncatcher Apr 22 '21 at 08:58
  • `Which is not available on SAP Cloud Platform` [not true](https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.02/en-US/665870a6db6545fc905ad0413d7db89f.html) . The File System Services available on premise and on Cloud Foundry are implementations of a volume service. With both XS advanced on-premise and on Cloud Foundry you can create a service instance by using the service fs-storage with the service plan “free” – Suncatcher Apr 22 '21 at 09:01
  • Well, ok, he didn't say what CF. Fair enough. Nonetheless, if he tries to use SAP Cloud Platform I still think the comment is true. I do not know why you link to 2.0 SPS 02, while the more recent help versions clearly state "The file system service is not available on SAP Cloud Platform.". – breadcrumb42 Apr 22 '21 at 11:55
  • @Suncatcher Ohh let me try this one here, not sure if i will make everything right... – liu baijun Apr 23 '21 at 02:16
  • @breadcrumb42 yeah it's on SAP CF , a little bit different from others.. – liu baijun Apr 23 '21 at 02:17
0

SAP Cloud Platform / SAP BTP does not have a service that allows you to access SMB drives. One possibility would be to use a SMB/SAMBA Java client library, configure the Firewall / SAP Cloud Connector accordingly. We once implemented something like that, but there are some challanges on the way.

An other, easier, possibility would be to create an on-premise service (e.g. REST) that allows you to access the files. This service needs to be made available to SCP as well, for example, through SAP API Management.

breadcrumb42
  • 165
  • 1
  • 8