0

I was runnning a jar file in a remote server when this error occurred:

java.io.FileNotFoundException: \\remoteServer2\foo\bazz\bar\myFile.pdf (The system cannot contact a domain controller to service the authentication request. Please try again later)

Here is my code:

File file = new File("\\remoteServer2\foo\bazz\bar");
boolean isSuccess = file.mkdirs();
filePath = file + "myFile.pdf";
JasperExportManager.exportReportToPdfFile(foofoo, filePath);

I'm guessing it could be that the remote server where the jar file was ran has no access to remoteServer2. I noticed that the file path above that was supposed to be created by the program was not created. The boolean variable returns false as its value.

I tried replicating the error in my environment but I failed to do so. I almost reproduce the error mentioned above except the message inside the parenthesis was "The network path was not found".

Maybe someone can help me solve the problem I'm facing right now. Or at least help me to reproduce the error in my environment to make it easier for me to solve the problem.

Any help would be appreciated.

Need2learn
  • 41
  • 1
  • 9
  • I think it's not possible to get a file from a remote server just like that. It'd be better to have a RESTful service that provides you the file when you request it. Another way use SFTP or another protocol that will authorize you in a remote server. Check out https://www.baeldung.com/java-file-sftp – Onur Baştürk Sep 17 '20 at 12:56
  • @OnurBaştürk But I'm not trying to get a file. I'm trying to create one and store it in a remote server. – Need2learn Sep 17 '20 at 13:03
  • 1
    I see! The same link includes a part called 2.3. Uploading a File With JSch. Just check it out it'll help. – Onur Baştürk Sep 17 '20 at 13:14

0 Answers0