[jcifs] Re: SmbAuthException during makedirs()

Rakesh rakesh.bhakta at conformative.com
Fri Jan 21 15:03:31 GMT 2005


Michael B Allen <mba2000 <at> ioplex.com> writes:

> Well that error is coming from the server so it's legit. Double check your
> credentials.
> 
> Mike

I have found a problem with my usage of credentials as you sugguested.  It 
seems, that specifing the credentails again when creating a new smbfile 
for the directory will work.  My usage of file.getParent() assumed a 
return object of smbfile which inherited credentials was very wrong.  
file.getParent() returns simpile string!

Following fails:

NtlmPasswordAuthentication userCred = new NtlmPasswordAuthentication(domain, 
username, password);
SmbFile cifsDir = new SmbFile( netPath, userCred);
SmbFile parent = new SmbFile( file.getParent() )
parent.mkdirs();  // <-- Throws exception


Following will work:

NtlmPasswordAuthentication userCred = new NtlmPasswordAuthentication(domain, 
username, password);
SmbFile cifsDir = new SmbFile( netPath, userCred);
SmbFile parent = new SmbFile( file.getParent() ),  userCred  );        
parent.mkdirs(); // now works.


Thanks for the pointer to the credentials.





More information about the jcifs mailing list