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?