[jcifs] Operation timed out: connect:could be due to invalid address with jcifs-1.3.3

Michael B Allen ioplex at gmail.com
Mon Jun 15 21:40:01 GMT 2009

On Mon, Jun 15, 2009 at 12:20 PM, jack Chen<ccc_007212 at 163.com> wrote:
> I'm running the following example Java class, with jcifs-1.3.2.jar in
> the classpath:
>  SmbFile file = new SmbFile("smb://user:123456@");
> I get Exception:
> jcifs.util.transport.TransportException
> java.net.SocketException: Operation timed out: connect:could be due to
> invalid address
>        at java.net.PlainSocketImpl.socketConnect(Native Method)
>        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:336)
>        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:201)
>        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:188)
>        at java.net.Socket.connect(Socket.java:482)
>        at java.net.Socket.connect(Socket.java:432)
>        at java.net.Socket.<init>(Socket.java:339)
>        at java.net.Socket.<init>(Socket.java:150)
>        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:249)
>        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:306)
>        at jcifs.util.transport.Transport.run(Transport.java:240)
>        at java.lang.Thread.run(Thread.java:570)

This is a low-level socket error that is occurring when JCIFS is
simply trying to create a socket. If 1.1.11 worked, then the problem
is probably that this "Alx OS" whatever that is is only listening on
port 139 and dropping packets on port 445. Normally if a
ConnectException or NoRouteToHostException occurs, JCIFS will retry on
port 139 but since it's just a SocketException and a timeout there's
not much we can do about catching that and retrying.

Try setting jcifs.netbios.hostname = WHATEVER. One artefact of setting
this property is that it forces the use of port 139. It's a bit of a
hack but it should work.


Michael B Allen
Java Active Directory Integration

More information about the jcifs mailing list