I am trying to read file from a mount point in the server where I am deploying the java code. Part of the java code is as below:
public static String encodeFileToBase64Binary(String fileName) throws IOException {
File file = new File(fileName);
byte[] bytes = loadFile(file);
byte[] encoded = Base64.encodeBase64(bytes);
String encodedString = new String(encoded);
return encodedString;
}
But it is throwing ERROR:
Callout to java method "public static java.lang.String encodebase64.EncodeBase64.encodeFileToBase64Binary(java.lang.String) throws java.io.IOException" resulted in exception: /data1/Test_Folder/EmailAttachment/AttachmentOSBTest.txt (No such file or directory) java.io.FileNotFoundException: /data1/Test_Folder/EmailAttachment/AttachmentOSBTest.txt (No such file or directory)
I tried placing the file in {$user.home} in the server and then reading from that path and it is working. Reading from Mount point in server is failing. What extra should I specify in the code?