状态访问被拒绝(0xc 0000022):无法连接到-使用smbj JAVA库访问Azure Netapps文件共享(网络驱动器)

cld4siwp  于 2023-01-19  发布在  Java
关注(0)|答案(1)|浏览(120)

正在尝试从Azure Netapps(网络驱动器)读取文件。我们已成功使用Windows文件资源管理器装载和读取文件。
使用相同的凭据,我们尝试使用JAVA smbj库。
在eclipse中执行java代码时,出现以下错误,

com.hierynomus.mssmb2.SMBApiException: STATUS_ACCESS_DENIED (0xc0000022): Could not connect to \\AZUREANF.com\imagestorage
.
.
Suppressed: com.hierynomus.mssmb2.SMBApiException: STATUS_ACCESS_DENIED (0xc0000022): Error closing connection to \\AZUREANF.com\IPC$
  • 共享服务器名称-AZUREANF.com
  • 共享文件夹-图像存储

完整的日志...

[main] INFO com.hierynomus.smbj.connection.PacketEncryptor - Initialized PacketEncryptor with Cipher << AES_128_GCM >>
[main] INFO com.hierynomus.smbj.connection.Connection - Successfully connected to: AZUREANF.com
[main] INFO com.hierynomus.smbj.connection.SMBSessionBuilder - Successfully authenticated TWSpringvale on AZUREANF.com, session is 3250754506031368179
[main] INFO com.hierynomus.smbj.session.Session - Connecting to \\AZUREANF.com\imagestorage on session 3250754506031368179
[main] INFO com.hierynomus.smbj.paths.DFSPathResolver - Attempting to resolve \\AZUREANF.com\imagestorage through DFS
[main] INFO com.hierynomus.smbj.paths.DFSPathResolver - Starting DFS resolution for \\AZUREANF.com\imagestorage
[main] INFO com.hierynomus.smbj.session.Session - Connecting to \\AZUREANF.com\IPC$ on session 3250754506031368179
[main] INFO com.hierynomus.smbj.session.Session - Logging off session 3250754506031368179 from host AZUREANF.com
[main] INFO com.hierynomus.smbj.connection.Connection - Closed connection to AZUREANF.com
[Packet Reader for AZUREANF.com] INFO com.hierynomus.smbj.transport.tcp.direct.DirectTcpPacketReader - Thread[Packet Reader for AZUREANF.com,5,main] stopped.
com.hierynomus.mssmb2.SMBApiException: STATUS_ACCESS_DENIED (0xc0000022): Could not connect to \\AZUREANF.com\imagestorage
    at com.hierynomus.smbj.session.Session.connectTree(Session.java:151)
    at com.hierynomus.smbj.session.Session.connectShare(Session.java:113)
    at Reader.NetworkFilereader(Reader.java:70)
    at Reader.main(Reader.java:129)
    Suppressed: com.hierynomus.mssmb2.SMBApiException: STATUS_ACCESS_DENIED (0xc0000022): Error closing connection to \\AZUREANF.com\IPC$
        at com.hierynomus.smbj.share.TreeConnect.close(TreeConnect.java:72)
        at com.hierynomus.smbj.share.Share.close(Share.java:116)
        at com.hierynomus.smbj.session.Session.logoff(Session.java:236)
        at com.hierynomus.smbj.session.Session.close(Session.java:279)
        at com.hierynomus.smbj.connection.Connection.close(Connection.java:178)
        at com.hierynomus.smbj.connection.Connection.close(Connection.java:155)
        at Reader.NetworkFilereader(Reader.java:118)
        ... 1 more

如何解决这个问题?

58wvjzkj

58wvjzkj1#

将smbj-0.11.5与Azure NetApp文件一起使用时遇到相同的问题。
在使用3.1.1方言(https://github.com/hierynomus/smbj/issues/747)时,似乎存在与客户端和服务器之间的加密协商相关的问题。
我建议尝试以下任何一种解决方法:

  • 将SMB方言降级到3.0:SmbConfig.builder().withDialects(SMB2Dialect.SMB_3_0)
  • 显式启用加密(仍使用3.1.1方言):SmbConfig.builder().withEncryptData(true)

这两个都为我工作的smbj-0.11.5和Azure NetApp文件。

相关问题