[jcifs] jcifs.smb.SmbException: Unsupported trying to list samba shares of Linux Box

rosso fivefinger at gmx.net
Fri Nov 14 11:37:16 GMT 2008


Hello people! 

Im about to write a small app to do incremental backups of samba shares in a
local network.
While playing around with the jcifs module (1.3.0) i experienced problems
browsing a share on a linux box running smbd 3.2.3
While this test Code works fine for a Winbox on the same network it fails on the
linux box.

smb://diskordia/ found                         #note: smb.exists()
jcifs.smb.SmbException: Unsupported            #note: smb.list() 
        at jcifs.smb.SmbComSessionSetupAndX.<init>(SmbComSessionSetupAndX.java:82)
        at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:282)
        at jcifs.smb.SmbSession.send(SmbSession.java:234)
        at jcifs.smb.SmbTree.treeConnect(SmbTree.java:161)
        at jcifs.smb.SmbFile.doConnect(SmbFile.java:850)
        at jcifs.smb.SmbFile.doShareEnum(SmbFile.java:1725)
        at jcifs.smb.SmbFile.doEnum(SmbFile.java:1673)
        at jcifs.smb.SmbFile.list(SmbFile.java:1646)
        at jcifs.smb.SmbFile.list(SmbFile.java:1543)
        at HornySync.main(HornySync.java:20)

Is this some incompatibility? 
I also tried to set up the environment properly by configuring the linux box as
WINS Server and setting jcifs.netbios.wins to the corresponding ip. 
Funny is that smb.exists() works for just the server (smb://diskordia/), but
reports "unsupported" for the share (smb://diskordia/data/).

Here's my Testcode:

import jcifs.smb.*;
import java.net.URL;

public class HornySync {
    public static void main (String[] args) {
        URL path = null;
        SmbFile smb = null;
        jcifs.Config.registerSmbURLHandler();
        try {path = new URL("smb://diskordia/");}
        catch (Exception e) {e.printStackTrace( System.out);}
        try {smb = new SmbFile(path);}
        catch (Exception e) {e.printStackTrace( System.out);}
        try {if (smb.exists()) {System.out.println(smb+" found");}}
        catch (SmbException e) {e.printStackTrace( System.out);}
        String [] files = new String[600];
        try {
            files = smb.list();
            for (String file : files) {
                System.out.println(file);
            }
        }
        catch (SmbException e) {e.printStackTrace( System.out);}
    }
}


Any help is appreciated. 

Cheeers


rosso



More information about the jcifs mailing list