JCIFS访问被拒绝

编程入门 行业动态 更新时间:2024-10-26 15:21:42
本文介绍了JCIFS访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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访问被拒绝

本文发布于:2023-10-13 00:31:06,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:被拒   JCIFS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!