[jcifs] jcifs problem and wins resolution

andrea.lanza at frameweb.it andrea.lanza at frameweb.it
Fri Sep 27 01:54:21 EST 2002

Thank you very much, it worked !!!

I moved the PDC emulator role from SRVGE03 to SRVGE02 using NTDSUTIL

The entry in the Wins Server regarding
moved, pointing to the ip address of SRVGE02, reflecting the change

At this point the broadcast for the master browser was answered, and I got
listed all workgroups and domains.

I supposed that there could be a problem of being myself (SRVGE03) the
master browser,
but what I really didn't know was that a broadcast is not answered by the
caller !

I think it colud be a good idea to implement a mechanism of checking local
netbios name table
before broadcasting for a NetBIOS name.

Thank you  again !


                      Joe Bentley                                                                                                      
                      <jbentley at zonelab        To:       "'andrea.lanza at frameweb.it'" <andrea.lanza at frameweb.it>,                      
                      s.com>                    jcifs at lists.samba.org                                                                  
                      Sent by:                 cc:                                                                                     
                      jcifs-admin at lists        Subject:  RE: [jcifs] jcifs problem and wins resolution                                 
                      26/09/2002 14.23                                                                                                 

> My servlet runs on the SRVGE03 Windows 2000 Server PDC,
> which also happens to be the DMB; IPCONFIG on SRVGE03 states also that
> it is an H-node, and its Wins "client" configuration points to SRVGE02,
> another
> Windows 2000 Server DC running the Wins server service.
> In conclusion:
> I have the  \01\02__MSBROWSE__\02<01>  entry in my Wins Server
> but even if I don't query the Wins Server:
> I have the  \01\02__MSBROWSE__\02<01> registered on my network (if I type
> NBTSTAT -n on SRVGE03 I see the entry)
> and I should get this name via Broadcast !
> I specified the following properties in my servlet:
>         jcifs.Config.setProperty("jcifs.netbios.wins", "");
>         jcifs.Config.setProperty("jcifs.netbios.baddr",
>         jcifs.Config.setProperty("jcifs.resolveOrder", "WINS,DNS,BCAST");

I've noticed the same problem too.  It's because you are executing your
on the PDC and a host cannot broadcast to it self.

The problem can also be reproduced doing following:
  jcifs.Config.setProperty("jcifs.netbios.baddr", "");

If you move your code off the DCs, it should work, providing that the baddr
includes at least one DC.  Yeah I know it's a lame work around.  Let me
if you find a better answer.

That reminds me, the global jcifs.Config.setProperty("jcifs.netbios.baddr")
design doesn't work for me.  I need to be able to pass a broadcast address
into the SmbFile("smb://") call to locally override the jcifs.netbios.baddr
setting.  My jCIFS code is sitting on a gateway machine where I need to
broadcast to separate networks that may have over-lapping domain names.
Currently a single-threaded synchronized block is required to protect the
global baddr value before a broadcast call.

Here's an example:

class CIFSDriver {

 public static String getDomainController(String domain,
  String broadcastAddress) {

  InetAddress     baddr;

  try {
   baddr = InetAddress.getByName(broadcastAddress);
  catch (UnknownHostException e)
   baddr = null;

  try {
   return NbtAddress.getByName(domain, 0x1c, null,
  catch (UnknownHostException e)
   return null;

 public synchronized static void listDomains(String broadcastAddress)
  throws Exception {

  String oldAddr = jcifs.Config.getProperty("baddr");
  jcifs.Config.setProperty("baddr", broadcastAddress);

  SmbFile connection = new SmbFile("smb://");
  String[] domains = connection.list();
  for (int i = 0; i < domains.length; i++)
   System.out.println(domains[i] + ":" +

  if (oldAddr != null)
   jcifs.Config.setProperty("baddr", oldAddr);

 public static void main(String[] args) throws Exception {



More information about the jcifs mailing list