[jcifs] The system cannot find the path specified

Michael B Allen ioplex at gmail.com
Fri Jun 20 15:23:20 GMT 2008

On 6/20/08, Coppens Benoît (All4IT) <Benoit.Coppens at ucb-group.com> wrote:
> Hi,
>  I'm using the following code to retrieve a document from a DFS:
>  ********************
>  public static void main(String[] args) {
>   try {
>     jcifs.Config.setProperty( "jcifs.netbios.wins", "" );
>     NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("UCB-CORP", "E118616", "password");
>     SmbFile fileToGet = new SmbFile("smb://ntbrafscl011.dir.ucb-group.com/dfs/Sites/Braine/GTSO/GECTD/DSPE/Department organization/Archives/Time sheet/TS SVL SVT JLH - 060504.xls", auth);
>     SmbFileInputStream in = new SmbFileInputStream(fileToGet);
>     byte[] b = new byte[8192];
>     int n;
>     while(( n = in.read( b )) > 0 ) {
>       System.out.write( b, 0, n );
>     }
>   }
>   catch (Exception e) {
>     e.printStackTrace();
>   }
>  }
>  ********************
>  If I use jcifs-1.2.18.jar, it works fine.
>  If I use jcifs-1.2.21.jar, it does not work and the error is:
>  ********************
>  1: new Socket: java.net.DatagramSocket at 54172f
>  2: new Socket: Socket[addr=/,port=445,localport=3262]
>  3: new Socket: Socket[addr=/,port=445,localport=3263]
>  jcifs.smb.SmbException: The system cannot find the path specified.
>   at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
>   at jcifs.smb.SmbTransport.send(SmbTransport.java:642)
>   at jcifs.smb.SmbSession.send(SmbSession.java:239)
>   at jcifs.smb.SmbTree.send(SmbTree.java:109)
>   at jcifs.smb.SmbFile.send(SmbFile.java:718)
>   at jcifs.smb.SmbFile.open0(SmbFile.java:923)
>   at jcifs.smb.SmbFile.open(SmbFile.java:940)
>   at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:70)
>   at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:62)
>   at com.ucb.ntlm.main(ntlm.java:20)
>  ********************
>  What could be the reason?

The DFS code was changed significantly recently. Previously we didn't
fully understand how referrals were used to discover DFS topology at
the roots. We just iterated overall all IPs for the supplied server
name until we found what we were looking for. It was crude but it
worked. That code is now superseded by proper DFS referral code that
looks up and caches the list of trusted domains and then looks up and
caches which server is hosting the target share and so on. So that
could be a factor in your issue.

To determine what the problem is you first need to determine if you're
using domain-based or stand-alone DFS. If you are using domain-based
DFS then is the following really a domain name or is it a full


Perhaps you want to use smb://dir.ucb-group.com/dfs... or
smb://ucb-group.com/dfs... etc?

Try going to a Windows client and do Start > Run and put in the
corresponding UNC path

Does it work? If it does but the corresponding smb:// path does not,
then that is an incompatibility with JCIFS that we should probably

If you determine that you are using stand-alone DFS (doubt it if the
share name is really 'dfs') then it's just a bug in JCIFS and I'll
have to convince you to send me captures.


Michael B Allen
PHP Active Directory SPNEGO SSO

More information about the jcifs mailing list