[jcifs] Connection Timeout errors

Michael B Allen mba2000 at ioplex.com
Mon Jan 3 22:32:05 GMT 2005

Jimmy Ray said:
> I am using jcifs.http.NtlmHttpFilter in my web.xml.  Everything seems to
> work
> fine, but occasionally I get a "Connection timed out exception" in my app
> log
> and the web app becomes unresponsive.  Here is part of the stacktrace:
> jcifs.smb.SmbException: An error occured sending the request.
> java.net.ConnectException: Connection timed out
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
> 	at java.net.PlainSocketImpl.connectToAddress

This means that you have a DC being returned in the list of DCs from WINS
that is not responding to the initial socket connection. Unless it's the
only DC it should be harmless. The filter should transparently failover to
a different DC.

If you want to find out which DC is bad, try this proggie:

import jcifs.netbios.NbtAddress;
import jcifs.*;
import jcifs.smb.*;

public class CheckAllDC {

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

        NbtAddress[] addrs = NbtAddress.getAllByName( argv[0], 0x1C, null,
null );

        for( int i = 0; i < addrs.length; i++ ) {
            System.out.println( addrs[i] );
            UniAddress dc = new UniAddress( addrs[i] );
            NtlmPasswordAuthentication auth = new
NtlmPasswordAuthentication( argv[1] );
            SmbSession.logon( dc, auth );

and run it like:

$ java -Djcifs.properties=../me.prp CheckAllDC MYDOMAIN "mydomain;me:mypass"

This runs successfully for about 15 DCs about 1 per second.

> 		<init-param>
> 			<param-name>jcifs.smb.client.soTimeout</param-
> name>
> 			<param-value>10000</param-value>
> 		</init-param>

Setting soTimeout here like this really isn't a good idea. If there's a
lot of volume you'll spend a lot of time building up and tearing down
connections to the DC.


More information about the jcifs mailing list