[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:
> 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:firstname.lastname@example.org/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
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.
More information about the jcifs