[jcifs] newbie problems

Mark Shifman mark.shifman at yale.edu
Mon Jul 18 13:48:26 GMT 2005


Michael B Allen wrote:

>Add some System.out.printlns to SmbTransport.java:228 to print all of the arguments passed to the Socket constructor. 
>  
>
private void negotiate( int port, ServerMessageBlock resp ) throws 
IOException {
        /* We cannot use Transport.sendrecv() yet because
         * the Transport thread is not setup until doConnect()
         * returns and we want to supress all communication
         * until we have properly negotiated.
         */
        synchronized (sbuf) {
            if (port == 139) {
                ssn139();
            } else {
        System.out.println("address " +  address.getHostAddress() + " 
port " + port + " localAddr " + localAddr+" local port " + localPort);
                socket = new Socket( address.getHostAddress(), port, 
localAddr, localPort );
...
outputs:
address 172.23.78.119 port 445 localAddr moussaka/127.0.0.1 local port 0

So the constructor doesn't like what it is given as localAddr.   If I 
put my real ip adress in ,  the socket is created. 
Either I have my machine configured strangely (it seems to work with 
everything else) or jcifs is picking up my local address incorrectly
or (the most likely) I don't really understand what is going on.
mas

>PS: Pls reply-all so that all messages are sent to the jcifs mailing list (minus sensitive information like packet captures).
>
>On Fri, 15 Jul 2005 13:31:32 -0400
>Mark Shifman <mark.shifman at yale.edu> wrote:
>
>  
>
>>Well... I created a socket and it didn't throw any exceptions
>>I also did a telnet to host on port 139.  I don't think there are
>>any funny firewalls lirking since I can get there with smbclient.
>>
>>any other ideas?
>>mas
>>
>>
>>Michael B Allen wrote:
>>
>>    
>>
>>>On Fri, 15 Jul 2005 10:24:05 -0400
>>>Mark Shifman <mark.shifman at yale.edu> wrote:
>>>
>>> 
>>>
>>>      
>>>
>>>>Hi:
>>>>I tried what you said but I get the same error.
>>>>   
>>>>
>>>>        
>>>>
>>>There's something more fundamentally wrong. This bascially shows that you can't even create a socket. Can you do $ telnet server 139? Are you running in within a VM or have a firewall? Try a very simple program that just does:
>>>
>>> Socket sock = new Socket( serverip, 139 );
>>>
>>>Otherwise, I'm stumped. There's definately something odd about your environment because jcifs isn't even creating a socket to the remote host.
>>>
>>>Mike
>>>
>>> 
>>>
>>>      
>>>
>>>>doFindFirstNext: \
>>>>Exception in thread "main" jcifs.smb.SmbException:
>>>>jcifs.util.transport.TransportException
>>>>java.net.SocketException: Invalid argument or cannot assign requested 
>>>>address
>>>>   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:184)
>>>>   at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:228)
>>>>   at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:266)
>>>>   at jcifs.util.transport.Transport.run(Transport.java:204)
>>>>   at java.lang.Thread.run(Thread.java:534)
>>>>
>>>>   at jcifs.util.transport.Transport.run(Transport.java:220)
>>>>   at java.lang.Thread.run(Thread.java:534)
>>>>
>>>>   at jcifs.smb.SmbTransport.connect(SmbTransport.java:256)
>>>>   at jcifs.smb.SmbTree.treeConnect(SmbTree.java:122)
>>>>   at jcifs.smb.SmbFile.connect(SmbFile.java:791)
>>>>   at jcifs.smb.SmbFile.connect0(SmbFile.java:761)
>>>>   at jcifs.smb.SmbFile.send(SmbFile.java:660)
>>>>   at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1679)
>>>>   at jcifs.smb.SmbFile.list(SmbFile.java:1544)
>>>>   at jcifs.smb.SmbFile.list(SmbFile.java:1436)
>>>>   at smbtest.main(smbtest.java:49)
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>This is a low-level socket error that doesn't have anything to do with
>>>>>jCIFS. The bug you cited was about failure to fall back from port 445
>>>>>to port 139 but this exception shows port 139 so the fallback is working
>>>>>properly in your case. It's more likely that the parameters given to the
>>>>>socket are wrong because the URL is being interpreted incorrectly. Use
>>>>>a properties file to increase the log level to 10. See if you can see
>>>>>what the servername is that is being used just before the exception. If
>>>>>you do not know how to interpret the output send be the last 1000 lines
>>>>>of the log and I'll take a look.
>>>>>
>>>>>Also, try different credentials that do NOT have a '/' in the password. I
>>>>>have a feeling that might be the culprit even if you URL decode it.
>>>>>
>>>>>Mike
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>   
>>>>
>>>>        
>>>>
>>> 
>>>      
>>>
>>    
>>
>
>  
>


-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shifman at yale.edu



More information about the jcifs mailing list