Search code examples
javasmbnas

Issue with SMB API while connecting to remote share folder using Java


artifact : smbj version : 0.3.0

Able to connect to the server but when it try to access the

DiskShare share = (DiskShare) session.connectShare(sambaSharedPath);

Below Exception is throwing. Please suggest fix.

com.hierynomus.mssmb2.SMBApiException: STATUS_BAD_NETWORK_PATH(3221225662/3221225662): Could not connect to \\SharePatch\
    at com.hierynomus.smbj.session.Session.connectTree(Session.java:113)
    at com.hierynomus.smbj.session.Session.connectShare(Session.java:98)
    at com.smbj.test.CreateNASFile.upload(CreateNASFile.java:71)
    at com.smbj.test.CreateNASFile.main(CreateNASFile.java:107)

Solution

  • Issue got resolved after passing shaereName and sharePath separately (We should not pass full combined path).