0

I am trying to connect to windows network drive using Jcifs = 1.3.17 in java

code

String baseAddress = "smb://file-123/XYZ_Others/"
String DOMAIN = "XYZ"
smbFile = new SmbFile(baseAddress, new NtlmPasswordAuthentication(DOMAIN, userName, password))
//How i am using  smbFile
final boolean isDirectory = smbFile.isDirectory(); //getting error here

If i run the code from mac it is working fine [it can able to connect] however if i try to run from linux [amazon cloud] i am getting following error

cifs.smb.SmbException: Failed to connect to server
        at jcifs.smb.SmbFile.connect0(SmbFile.java:882) ~[jcifs-1.3.17.jar:?]
        at jcifs.smb.SmbFile.queryPath(SmbFile.java:1335) ~[jcifs-1.3.17.jar:?]
        at jcifs.smb.SmbFile.exists(SmbFile.java:1417) ~[jcifs-1.3.17.jar:?]
        at jcifs.smb.SmbFile.isDirectory(SmbFile.java:1490) ~[jcifs-1.3.17.jar:?]

When i try to use smb client from command prompt

smbclient -L smb://test/ -U username -W ANT -R host -D DIR  

Getting error as

Connection to smb: failed (Error NT_STATUS_BAD_NETWORK_NAME)
Jeya Kumar
  • 1,002
  • 1
  • 13
  • 36
  • I guess your file server is not reachable from the internet... – ajuch Apr 19 '19 at 09:44
  • Your Amazon cloud is connected to your server using VPN? If not it will not work because you are not in the same network. Is the Mac located in the same network as the Server? – Eliad Cohen Apr 28 '19 at 09:24
  • 1
    Hi, Thanks both yes, it is network related problem.Once we move the drive to same region as cloud desktop it starts to work fine. thanks – Jeya Kumar Apr 29 '19 at 12:16
  • @JeyaKumar does your comment mean that the problem is resolved by having cloud machine in same region as network drive? – Merlin Apr 16 '21 at 17:49
  • @Merlin : yes . for example my windows drive and cloud-desktop were in same region us-east-1 – Jeya Kumar Apr 18 '21 at 01:33

0 Answers0