[jcifs] JCIFS and Connection TimeOut exception..Please help

Ram Chavali rchavali at vmware.com
Wed Mar 4 05:04:33 GMT 2009


Hi Michael,

I need to discover all windows groups/Domains and computers  from linux box. I assume I can also use 'SmbTree' command. But, i think either SmbTree internally uses NetBios Session service.(Please let me know if I am wrong). With this network is there any other way I can use JCIFS to get the results.

Thanks
Ram Chavali 

-----Original Message-----
From: Michael B Allen [mailto:ioplex at gmail.com] 
Sent: Tuesday, March 03, 2009 8:24 PM
To: Ram Chavali
Cc: jcifs at lists.samba.org
Subject: Re: [jcifs] JCIFS and Connection TimeOut exception..Please help

On Tue, Mar 3, 2009 at 9:38 PM, Ram Chavali <rchavali at vmware.com> wrote:
> Thanks Michael for your quick response. Even with ListFiles it is doing the samething. Below is the log..
> What is this IP: 192.168.154.1. Is it the master browser. Also do I need to set any other properties like "Wins' etc. Please let me know.
> Also it was timed out when I tried to ping "192.168.154.1" .

Listing smb:// requires a properly maintained NetBIOS network with a working "master browser". It does not sound like that is what you have.

Setting WINS will not help listing smb:// since that queries the local master browser.

Unfortunately NetBIOS really isn't that popular anymore and getting a reliable master browser is not reliable.

There's really no good way to get a listing of the machines on a network.

Mike

> -----Original Message-----
> From: Michael B Allen [mailto:ioplex at gmail.com]
> Sent: Tuesday, March 03, 2009 5:24 PM
> To: Ram Chavali
> Cc: jcifs at lists.samba.org
> Subject: Re: [jcifs] JCIFS and Connection TimeOut exception..Please 
> help
>
> On Tue, Mar 3, 2009 at 7:38 PM, Ram Chavali <rchavali at vmware.com> wrote:
>> Hi,
>>
>> I am totally new to samba and JCIFS.
>
> Samba and JCIFS have very little to do with one another.
>
>> I have a simple code which creates a
>> Smbfile and when i try to call the method smbFile.listFiles() i am 
>> getting Connection timeOut exception. Could you please help me with this issue.
>>
>> I am also attaching the Debugfile.log file Here is the code
>
> NameQueryResponse[nameTrnId=1,isResponse=true,opCode=QUERY,isAuthAnswe
> r=true,isTruncated=false,isRecurAvailable=false,isRecurDesired=true,is
> Broadcast=false,resultCode=0,questionCount=0,answerCount=1,authorityCo
> unt=0,additionalCount=0,questionName=null,questionType=0x0000,question
> Class=IN,recordName=..__MSBROWSE__.<01>,recordType=NB,recordClass=IN,t
> tl=300000,rDataLength=18,addrEntry=[Ljcifs.netbios.NbtAddress;@18558d2
> ]
> 00000: 00 01 85 00 00 00 00 01 00 00 00 00 20 41 42 41  |............ 
> ABA|
> 00010: 43 46 50 46 50 45 4E 46 44 45 43 46 43 45 50 46  
> |CFPFPENFDECFCEPF|
> 00020: 48 46 44 45 46 46 50 46 50 41 43 41 42 00 00 20  
> |HFDEFFPFPACAB.. |
> 00030: 00 01 00 04 93 E0 00 12 C0 00 C0 A8 9A 01 C0 00  
> |.....à..À.À¨..À.|
> 00040: C0 A8 C7 01 C0 00 0A 14 86 53                    |À¨Ç.À....S      
> |
>
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
> NetBIOS: new data read from socket
>
> This shows that the listFiles on smb:// URL did a NetBIOS lookup for the special __MSBROWSE__ name. That's ok. But then 8 computers responded that they were master browsers. That's a little awkward since there's really only supposed to be one master browser on the network and there are "elections" to ensure that this is true.
>
> doConnect: 0.0.0.0<00>/192.168.154.1
> Exception in thread "main" jcifs.smb.SmbException: Connection timeout
> jcifs.util.transport.TransportException: Connection timeout
>    at jcifs.util.transport.Transport.connect(Transport.java:178)
>    at jcifs.smb.SmbTransport.connect(SmbTransport.java:294)
>    at jcifs.smb.SmbTree.treeConnect(SmbTree.java:141)
>    at jcifs.smb.SmbFile.doConnect(SmbFile.java:858)
>    at jcifs.smb.SmbFile.connect(SmbFile.java:901)
>    at jcifs.smb.SmbFile.connect0(SmbFile.java:827)
>
> This exception means that the doConnect method never completed before the connection timeout period. It is difficult to tell if this is incorrect behavior because you set a high responseTimeout value. It would have been better to report what happends if you do not set that value. Better still, just run java -Djcifs.properties=my.prp ListFiles smb://.
>
> My guess is that JCIFS cannot connect to 192.168.154.1 or it is not responding.
>
> Mike
>
>> public static void main(String[] args) throws SmbException {
>>
>> try {
>>
>>             System.setProperty("jcifs.smb.client.responseTimeout",
>> "330000");
>>
>>             System.setProperty("jcifs.util.loglevel", "10");
>>
>>             SmbFile s = new SmbFile( "smb://" );
>>
>>             if( s.exists() )
>>
>>             {
>>
>>                     if( s.getType() == SmbFile.TYPE_WORKGROUP )
>>
>>                     {
>>
>>                     SmbFile[] smbFiles = s.listFiles();
>>
>>                     }
>>
>>             }
>>
>>             else
>>
>>             {
>>
>>             System.out.println( "Smbfile does not exist" );
>>
>>             }
>>
>> }
>>
>> catch (MalformedURLException e)
>>
>> {
>>
>> // TODO Auto-generated catch block
>>
>> e.printStackTrace();
>>
>> }
>>
>> }
>>
>> }
>
>
>
> --
> Michael B Allen
> Java Active Directory Integration
> http://www.ioplex.com/
>



--
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jcifs mailing list