jcifs.smb.SmbAuthException: Logon failure: account currently disabled

36 Views Asked by At

I am working on Smb APIs to connect to shared network drive and read the files. While using below code snippet I am getting "jcifs.smb.SmbAuthException: Logon failure: account currently disabled." at the line SmbFileInputStream sfis = new SmbFileInputStream.

Here's the code:

NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "userName", "Password");
SmbFile errorFolder = null;

String errorPath="//hostname/folder1/folder2/folder3/";
String urlError = "smb:" + errorPath;
errorFolder= new SmbFile(urlError, auth);

SmbFileInputStream sfis = new SmbFileInputStream(errorFolder+fileName);
System.out.println("----> reading "+sfis.read(fileName.getBytes()));

Please could anybody tell what could be the reason for this exception. I am using admin username and password only. I am also able to print list of files in shared location using Smb APIs. Only while reading the file I am getting exception.

1

There are 1 best solutions below

1
galme On

Issue is solved after adding

Config.setProperty("jcifs.smb.client.domain", "domain name");