[jcifs] SmbFile.listFiles() on own server takes a long time

Michael B. Allen miallen at eskimo.com
Tue Oct 1 05:02:55 EST 2002

On Mon, 30 Sep 2002 19:12:06 +1000
"Kid Kalanon" <kid_kalanon at hotmail.com> wrote:

> > > >
> > > >This is a name service lookup timeout. If you ex.printStackTrace()
> > > >you'll see that it's failing to lookup host4.
> > > >
> > >
> > > Yes, it did time out but it wouldn't have thrown an exception.  It would 
> >go
> > > on to the next thing in the resolve order - the default was RESOLVER_DNS 
> >and
> > > the call to InetAddress.getByName was successful.  So the call to 
> >listFiles
> > > was actually successful but it took a long time.
> >
> >Then    it    would    have    returned   right   away.   You   must   have
> >resolveOrder=BCAST,DNS  at  least  because  it's  trying  (and  failing) to
> >resolve the name using BCAST first.
> >
> Ok, I tried the setting "-Djcifs.resolveOrder=DNS,BCAST" and now it's much 
> faster!  I've just found the documentation for this, which I probably should 
> have read earlier.
> >
> >This  is  timing out on the broadcast lookup and they getting Access denied
> >trying  to  list  shares.  Relax  your permissions or use an account on the
> >machine.  You  could use the jcifs.netbios.lmhosts option to get around the
> >broadcast  failure  (although it is strange that it's failing to respond to
> >that).
> >
> Setting lmhosts is not appropriate for me bacause it is expected to run on 
> networks without the lmhosts setup.

If this is a common phenomenon for which nothing can be done using
existing parameters I suppose it would be appropriate to atrifically
populate the name service cache with the local hostname (or a good guess
of it) on startup. Bit of a hack but it would do the trick.

> Yes, the last example I sent did fail with authentication error.  I seemd to 
> have oversimplified it so the log won't be so long but it also produced a 
> different result.  Before the authentication error though, there was a name 
> lookup that did time out.
> ... but my problem is solved now, and I'm happy! Thanks.
> Kid.
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx

A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and more importantly to tasks that have not
yet been conceived. 

More information about the jcifs mailing list