我正在使用JCIFS写入Windows共享。这一直工作正常。突然它停止工作,我现在得到一个jcifs.smb.SmbAuthException:访问被拒绝。例外。我知道我的凭证是好的,因为我可以手动连接使用smb并写入文件夹,所以这不是问题。我使用的代码是: $ b $ pre $ NtlmPasswordAuthentication ntlm = new NtlmPasswordAuthentication(domain,userName,smbPassword); SmbFile文件=新SmbFile(smbPath,ntlm); SmbFileOutputStream outputStream = new SmbFileOutputStream(file) outputStream.write(fileContents) outputStream.close()
它在SmbFileOutputStream outputStream = new SmbFileOutputStream(file)行中爆发。这一切都没有改变几个月,一直工作得很好,所以我不知道为什么它会停止工作。有没有人有任何想法?由于我知道我的凭证很好,而且我确实有写入权限,所以我在这里完全失败。
错误消息以及您描述的是目标服务器上的文件权限问题。
更新 已确认(通过评论)当试图替换现有文件时它是一个权限问题。
I'm using JCIFS to write to a windows share. This has been working fine. All of a sudden it stopped working and I'm now getting a jcifs.smb.SmbAuthException: Access is denied. exception. I know that my credentials are good as I can connect using smb manually and write to the folder, so that's not the problem. The code I'm using is:
NtlmPasswordAuthentication ntlm = new NtlmPasswordAuthentication(domain, userName, smbPassword); SmbFile file = new SmbFile(smbPath, ntlm); SmbFileOutputStream outputStream = new SmbFileOutputStream(file) outputStream.write(fileContents) outputStream.close()It blows up on the "SmbFileOutputStream outputStream = new SmbFileOutputStream(file)" line. None of this has changed for months and has been working fine, so I'm not sure why it would stop working. Does anyone have any ideas? I'm at a complete loss here since I know my credentials are good and that I do have write access
解决方案As indicated by the error message and what you are describing it is a file permission issue on the target server.
Updated Confirmed (via comments) that it was a permissions issue when attempting to replace an existing file.
更多推荐
JCIFS访问被拒绝
发布评论