[jcifs] Unstabe error when using SmbFile[] jcifs.smb.SmbFile.listFiles()

Jakov giaodichdientu at gmail.com
Mon Sep 24 03:32:38 GMT 2007

Hi there,

I used jCIFS to get all domains in the network. Sometimes it works,
sometimes not. I have 3 domains, MSHOME, ROOM1, ROOM2.
-------------------------- code ---------------------
SmbFile[] domains;
       try {
               domains = (new SmbFile("smb://")).listFiles();
               for (int i = 0; i < domains.length; i++) {
               SmbFile[] servers = domains[i].listFiles();
/////////////-----> error here

For the first two domains, it lists all server all right. Looks like:
         + PC1
         + PC2
         + PC3
         + PC4

But when it moves to the last domain (ROOM2), the error occurs:

jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad
    at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:275)
    at jcifs.smb.SmbSession.send(SmbSession.java:228)
    at jcifs.smb.SmbTree.treeConnect(SmbTree.java:134)
    at jcifs.smb.SmbFile.connect(SmbFile.java:834)
    at jcifs.smb.SmbFile.connect0(SmbFile.java:797)
    at jcifs.smb.SmbFile.sendTransaction(SmbFile.java:659)
    at jcifs.smb.SmbFile.doNetEnum(SmbFile.java:1655)
    at jcifs.smb.SmbFile.listFiles(SmbFile.java:1604)
    at jcifs.smb.SmbFile.listFiles(SmbFile.java:1514)

It looks strange, because I still can list all servers in that domain using
"net view /domain:ROOM2".
Notice that sometimes JCIFS works well, sometimes it throws exception above.

Would you mind consider if it's a bug?

Thanks for your contribution.

-------------- next part --------------
HTML attachment scrubbed and removed

More information about the jcifs mailing list