[jcifs] Issues getting resources using "smb://" URL

Eric Newman eric at intapp.com
Wed Aug 17 23:58:51 GMT 2005

Hi Mike,

Thanks for your reply.

I did some more research and observed what you were describing.  When a
certain machine was chosen by LMB (one which has access to the network), it
would work; but when a different machine was chosen (one which did not have
access to the network), it would not work.

Do you know if I have any control (via using jcifs) over how to influence
which machine is chosen by the LMB?


-----Original Message-----
From: Michael B Allen [mailto:mba2000 at ioplex.com] 
Sent: Friday, August 12, 2005 12:35 PM
To: Eric Newman
Cc: jcifs at lists.samba.org
Subject: Re: [jcifs] Issues getting resources using "smb://" URL

On Fri, 12 Aug 2005 11:19:28 -0700
"Eric Newman" <eric at intapp.com> wrote:

> I am having issues trying to list all of the resources using the "smb:\\"
> url.  I am doing something like the following:
> SmbFile file = new SmbFile("smb:\\");

I think you meant to use "smb://" here.

> SmbFile[] files = null;
> try {
>     files = file.listFiles();
> The strange thing that is happening is that I am getting different results
> each time I run the program.  If I have not run the program in a while
> (where a while is around 10 minutes), then the program works.

That is because the "smb://" URL queries the Local Master Browser
(LMB) for the list of domains and that machine is determined by a
non-deterministic election protocol. Meaning, the LMB can be different
each time you query for it.

> However, if I have recently run the program, I can get one of the
> errors:
> Permission denied to smb://
> Exception attempting to list files on  smb://: 0xC00000CB

0xC00000CB is "The network resource type is not correct."

> Exception attempting to list files on  smb://: Logon failure: the user has
> not been granted the requested logon type at this computer.
> Any ideas why I am seeing different results each time?  Or why it does not
> work all of the time?

This is not unusual if there are many machines on the same physical
network that are not in the same workgroup and are secured to different
degrees. A college dorm would be exactly the kind of place where each
kids PC is managed separately.


More information about the jcifs mailing list