1

I'm using Apache Commons VFS library to read files from a secure network location. The extracted jar of this project is working fine in my development machine, but when deployed on dev server (different network) it is neither throwing any exception nor it is connecting to that secure location. The credentials to access the location and host address are correct. What could be the reason for the same code connecting/not connecting on different environments? Below is the code snippet in question.

UserAuthenticator auth = new StaticUserAuthenticator(DOMAIN, USERNAME, PASSWORD);
FileSystemOptions opts = new FileSystemOptions();
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);

DefaultFileSystemManager fsManager = new DefaultFileSystemManager();
fsManager.addProvider("file", new DefaultLocalFileProvider());
fsManager.init();
FileObject shareFolder = fsManager.resolveFile(SHARED_FOLDER_PATH, opts);
if (shareFolder.exists()) {
---------;
Perform some task;
------;
}

if (shareFolder.exists()) is true in my local machine but false in dev env. 1. What could be the issue for this behaviour? 2. Is there any other alternative for Apache Commons VFS to read/write files from secured network location passing username/password?

Ashraf
  • 143
  • 1
  • 8
  • have you verified that your dev server is whitelisted from the secure network location? – ThilankaD Apr 23 '20 at 14:34
  • I asume you use the same UNC path in both landscapes? Will they reach the same server? Did you try to manually connect from the client machines with windows explorer or smbc? – eckes Nov 05 '20 at 21:52

0 Answers0