[jcifs] Problems accessing DFS share

Johannes Martin johannes.martin at itc.deurag.de
Tue Sep 28 00:18:08 MDT 2010


Hi,

I've got a problem accessing a DFS share in our network using jcifs.

Here's a sample program to illustrate the problem:
---
import jcifs.smb.SmbFile;

public class TestSmbFile {
    public static void main(String args[]) throws Exception {
	SmbFile[] files = new SmbFile(args[0]).listFiles();
	for (SmbFile file : files) {
	    System.out.println(file.getPath());
	}
    }
}
---

In Windows, I can list the available shares by connecting to 
  \\my.domain.name\dfs

java TestSmbFile 'smb://<domain>;<user>:<pass>@my.domain.name/dfs/
gives me the following exception:
---
Exception in thread "main" jcifs.smb.SmbException: The network name cannot be 
found.
	at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:545)
	at jcifs.smb.SmbTransport.send(SmbTransport.java:645)
	at jcifs.smb.SmbSession.send(SmbSession.java:244)
	at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176)
	at jcifs.smb.SmbFile.doConnect(SmbFile.java:906)
	at jcifs.smb.SmbFile.connect(SmbFile.java:949)
	at jcifs.smb.SmbFile.connect0(SmbFile.java:875)
	at jcifs.smb.SmbFile.getType(SmbFile.java:1275)
	at jcifs.smb.SmbFile.doEnum(SmbFile.java:1726)
	at jcifs.smb.SmbFile.listFiles(SmbFile.java:1708)
	at jcifs.smb.SmbFile.listFiles(SmbFile.java:1641)
	at TestSmbFile.main(TestSmbFile.java:5)
---

If I access the file server directly using
java TestSmbFile 'smb://<domain>;<user>:<pass>@server.my.domain.name/dfs/
I get the listing I expect.

java TestSmbFile 'smb://<domain>;<user>:<pass>@my.domain.name/
seems to list only the local shares of whatever server my.domain.name maps to 
(my.domain.name has multiple DNS entries, so I get one of three distinct 
servers), but not "dfs".

Is this a known limitation of jcifs or am I doing something wrong?

Regards
	Johannes



More information about the jCIFS mailing list