[jcifs] NtlmHttpFilter - Uncaught SmbException

Eric eglass1 at comcast.net
Sat Jun 26 10:13:30 GMT 2004


If you've got jcifs.http.loadBalance=true (or unset, as it defaults to 
true), my guess would be that one of the controllers is down; that would 
account for the intermittent failures.  You could try the below; I think 
this would enumerate the domain controllers and obtain challenges from 
all of them (I say think because I haven't tested this):


import java.util.Properties;
import jcifs.UniAddress;
import jcifs.netbios.NbtAddress;
import jcifs.smb.SmbSession;

public class TestDC {

     public static void main(String[] args) throws Exception {
         char[] hex = "0123456789abcdef".toCharArray();
         String domain = args[0];
         Properties servers = new Properties();
         for (int i = 0; i < 100; i++) {
             UniAddress dc = new UniAddress(
                     NbtAddress.getByName(domain, 0x1c, null));
             try {
                 byte[] challenge = SmbSession.getChallenge(dc);
                 char[] hexChallenge = new char[16];
                 for (int j = 0, k = 0; j < 8; j++) {
                     hexChallenge[k++] = hex[(challenge[j] >> 4) & 0x0f];
                     hexChallenge[k++] = hex[challenge[j] & 0x0f];
                 }
                 servers.setProperty(dc.toString(),
                         new String(hexChallenge));
             } catch (Exception ex) {
                 System.out.println("Unable to contact " + dc);
                 ex.printStackTrace();
             }
         }
         servers.list(System.out);
     }

}


Eric


Bill Parkinson wrote:
> Using JCIFS 0.9.2 and Tomcat 4.1.30 and JDK 1.4.2_04-b05
> 
> The filter starts off working correctly.  Then after a while we get this 
> message as a Tomcat 500 error:  Later it works again...
> 
> jcifs.smb.SmbException: An error occured sending the request.
> java.net.ConnectException: Connection refused: connect
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
> 	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
> 	at java.net.Socket.connect(Socket.java:452)
> 	at java.net.Socket.connect(Socket.java:402)
> 	at java.net.Socket.<init>(Socket.java:309)
> 	at java.net.Socket.<init>(Socket.java:211)
> 	at jcifs.netbios.NbtSocket.<init>(NbtSocket.java:59)
> 	at jcifs.smb.SmbTransport.ensureOpen(SmbTransport.java:275)
> 	at jcifs.smb.SmbTransport.send(SmbTransport.java:602)
> 	at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:847)
> 	at jcifs.smb.SmbSession.getChallenge(SmbSession.java:59)
> 	at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:109)
> 
> That particular line of the Filter is not in a try catch block...
> 
> Anyone seen this before?  Any suggestions?  
> 
> 




More information about the jcifs mailing list