[jcifs] SmbAuthException while calling list() on a SmbFile("smb://").

Michael B Allen mba2000 at ioplex.com
Mon Sep 6 18:58:34 GMT 2004


On Mon, 6 Sep 2004 20:32:28 +0200
"Michael P. Jung" <suriver at gmail.com> wrote:

> Hi,
> 
> I'm pretty new to JCIFS and simply can't figure out how to use it to
> browse a network full of different workgroups.
> 
> I expected this to list all available workgroups in my LAN:
> 
> --snip--
> 
> SmbFile smb = new SmbFile("smb://")
> 
> SmbFile[] files = smb.listFiles();
> for (int i=files.length-1; i>=0; i--) {
>     System.out.println(files[i].getName());
> }
> 
> --snip--
> 
> All I get is a SmbAuthException:
> Exception in thread "main" jcifs.smb.SmbAuthException: Logon failure:
> unknown user name or bad password.
> 
> I also tried to set jcifs.smb.client.username, password and domain to
> "guest" and "" but no combination worked for me.

You will likely get a wide variety of exceptions doing such things
depending on the credentials used and type of network. For example on
an ad-hoc university network of student dorm PCs you will likely get an
exception with every host. And that would be the correct behavior I hope!

Try to print out the path being accessed and when you get an exception
try to query that server directly and interrogate what is going on with
logging cranked up. Also use packet captures [1] to figure out what is
going wrong.

Mike

[1] http://jcifs.samba.org/capture.html

-- 
Greedo shoots first? Not in my Star Wars.


More information about the jcifs mailing list