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

Michael B Allen ioplex at gmail.com
Wed Mar 4 01:23:46 GMT 2009


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,isAuthAnswer=true,isTruncated=false,isRecurAvailable=false,isRecurDesired=true,isBroadcast=false,resultCode=0,questionCount=0,answerCount=1,authorityCount=0,additionalCount=0,questionName=null,questionType=0x0000,questionClass=IN,recordName=..__MSBROWSE__.<01>,recordType=NB,recordClass=IN,ttl=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/


More information about the jcifs mailing list