[jcifs] newbie problems

Mark Shifman mark.shifman at yale.edu
Thu Jul 14 12:07:06 GMT 2005

thanks for your quick response. 
It sort of looks like https://bugzilla.samba.org/show_bug.cgi?id=2857
I tried the    modification to SmbTransport.java and recompiled the library
and got the same exception. I have tried my domain ( which I actually 
need to do
ths smbmount) and both ports. I also tried the NPA technique. Still the 
The complete exception below:

Exception in thread "main" jcifs.smb.SmbException:
java.net.SocketException: Invalid argument or cannot assign requested 
    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.ssn139(SmbTransport.java:178)
    at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:226)
    at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:269)
    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.listFiles(SmbFile.java:1570)
    at jcifs.smb.SmbFile.listFiles(SmbFile.java:1478)
    at smbtest.main(smbtest.java:53)

Michael B Allen wrote:

>On Wed, 13 Jul 2005 12:41:35 -0400
>Mark Shifman <mark.shifman at yale.edu> wrote:
>>I have been trying to connect to a share and I get this error:
>>Exception in thread "main" jcifs.smb.SmbException:
>>java.net.SocketException: Invalid argument or cannot assign requested 
>>... complete stack trace below.
>>my code is:
>>SmbFile file = new SmbFile( 
>>"smb://user:password@aserver.yale.edu/ashare/" );
>>String [] thelist = file.list();
>>Things die on file.list() or file.listFiles(), or even file.exists();
>>I can do a smbmount to the share  using my  linux box without any 
>>problems so I assume my username,
>>password, host etc are correct.
>>My password does contain a forward slash ie. / or %2f  however the new 
>>SmbFile seems to be fine.
>You probably need the domain (or machine name if it's a local account). So
>   smb://dom;user:pas%2Fword@server.yale.edu/ashare/
>You can also create an NPA and then use that like:
>   NtlmPasswordAuthentication npa = new NtlmPasswordAuthentication( "dom", "user", "pas/word" );
>   SmbFile file = new SmbFile( "smb://server.yale.edu/ashare/", npa );
>This is also good because you really shouldn't put the credentials in
>the URL anyway.

 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