I'm trying to use openwhisk cloud functions to leverage some existing java code. The code needs to read a local file. Is this supported in a Java Action on IBM Cloud? Though the file is included in the jar file - the application is not able to reach the file .
Asked
Active
Viewed 218 times
1 Answers
0
OpenWhisk actions can read from the file system. Changes to the runtime filesystem are not persisted across invocations.
If you want to include a file within the JAR, you will need to need to find the location of the JAR within the filesystem, unzip it and read the file contents.
The Java runtime stores the user-provided JAR in the system-wide temporary directory as useraction.jar
.
Another approach would be to store the file on an object storage service and retrieve it dynamically during invocations.

James Thomas
- 4,303
- 1
- 20
- 26
-
Thanks James for the response. We have the resource file included in the jar but the class file is not able to find it. shall try finding the file within jar and retry. Shall post an update. – Sreekanth Iyer Dec 21 '17 at 09:22