[JCIFS] Copier des données via SMB
Bonjour,
Je voudrais copier un fichier via SMB, mais j'ai un problème "Acces denied"
Un cou de pousse SVP, merci d'avance.
mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11
| try {
NtlmPasswordAuthentication npa = new NtlmPasswordAuthentication(
"192.168.1.2", "user", "123456");
SmbFile filesmb = new SmbFile("smb://192.168.1.2/c$/dir/", npa);
OutputStream destination = filesmb.getOutputStream();
InputStream originalfile = new FileInputStream("d://CV");
IOUtils.copy(originalfile, destination);
} catch (SmbException e) {
e.printStackTrace();
} |
Message d'erreur:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
jcifs.smb.SmbException: Access is denied.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
at jcifs.smb.SmbTransport.send(SmbTransport.java:663)
at jcifs.smb.SmbSession.send(SmbSession.java:238)
at jcifs.smb.SmbTree.send(SmbTree.java:119)
at jcifs.smb.SmbFile.send(SmbFile.java:775)
at jcifs.smb.SmbFile.open0(SmbFile.java:989)
at jcifs.smb.SmbFile.open(SmbFile.java:1006)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:142)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:67)
at jcifs.smb.SmbFile.getOutputStream(SmbFile.java:2853)
at SMPcopie.main(SMPcopie.java:50) |