java - jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password. Connecting to network share to save a .txt file -
well, problem following: need save .txt file inside shared folder, save , write in it. problem happend when shared network ask me user credentials , passwords, s how found jcifs library, try log in user name , password there setting, meen, user can change as can module inside aplication
wherein path definded smb:\ip\informe ventas\ archivo.txt code's attribute include following:
fileuri = "smb:"
filename = "file.txt"
credentialusername = "username" shared network
credentialpassword = "password" shared network pathruta= \ip\sales report\
path = smb:\ip\sales report\ file.txt
this concat
path = fileuri+pathruta+filename;
the problem in credentials, cause generate me exception tittle , when try input manualy option ejecute windows, user , password im using in program source (manualy log in whitout problem)
the code following.
string fileuri = file_uri; string namedomain = name_domain; string filename= start_name_file +"_"+formatcaltoday+ file_extension; string credentialsusername = getconfigurationvalue(delegator, "inventorymanagementpharmacyapp", "inventorygeneral", "pathrouteconfigurableuserforusername"); string credentialspassword = getconfigurationvalue(delegator, "inventorymanagementpharmacyapp", "inventorygeneral", "pathrouteconfigurableuserforpassword"); string pathruta = getconfigurationvalue(delegator, "inventorymanagementpharmacyapp", "inventorygeneral", "pathrouteconfigurableuserlevel"); final string user = credentialsusername + ":" + credentialspassword; final ntlmpasswordauthentication auth = new ntlmpasswordauthentication(user); string path = fileuri+pathruta+filename; final smbfile sfile = new smbfile(path, auth); final smbfileoutputstream salida2 = new smbfileoutputstream( sfile);
Comments
Post a Comment