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

Michael B Allen mba2000 at ioplex.com
Fri Aug 12 19:34:41 GMT 2005


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 following
> 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.
<snip>
> 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.

Mike


More information about the jcifs mailing list