[jcifs] newbie problems

Michael B Allen mba2000 at ioplex.com
Thu Jul 14 00:56:50 GMT 2005


On Wed, 13 Jul 2005 12:41:35 -0400
Mark Shifman <mark.shifman at yale.edu> wrote:

> Hi:
> I have been trying to connect to a share and I get this error:
> 
> Exception in thread "main" jcifs.smb.SmbException:
> jcifs.util.transport.TransportException
> java.net.SocketException: Invalid argument or cannot assign requested 
> address
> ... complete stack trace below.

where?

> 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
try:

   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.

Mike


More information about the jcifs mailing list