Java SMBJ引发传输/eof异常

Java SMBJ引发传输/eof异常,java,smb,microsoft-distributed-file-system,smbj,Java,Smb,Microsoft Distributed File System,Smbj,我正在利用SMBJ读取sbm文件,当一切正常时,它会抛出 com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet 我不明白为什么,它似乎正在正确地关闭一切。我将以下代码用于try with resource: try (File f = Smb.open(filename)) { do my work with the file }

我正在利用SMBJ读取sbm文件,当一切正常时,它会抛出

com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet
我不明白为什么,它似乎正在正确地关闭一切。我将以下代码用于try with resource:

  try (File f = Smb.open(filename)) {
   do my work with the file
  }
当我处理完文件后调用releaseShare方法,我看到很多注销会话,以及注销日志中嵌套的会话消息。。然而,这似乎并不重要,似乎库仍然认为会话/共享仍然打开,当它在10或15分钟后ping它时,抛出异常。。。从程序运行的角度来看,这似乎没有什么坏处,但我想消除错误。。。我没有正确关闭/处理什么

public static DiskShare getShare() throws Exception
{

    if(share == null){
        SmbConfig cfg = SmbConfig.builder().withDfsEnabled(true).build();
        SMBClient client = new SMBClient(cfg);
        Log.info("CREATE SHARE");
        connection = client.connect(sambaIP);
        session = connection.authenticate(new AuthenticationContext(sambaUsername, sambaPass.toCharArray(), sambaDomain));
        share = (DiskShare) session.connectShare(sambaSharedName);


    }
    return(share);

}

public static File open(String filename) throws Exception{
    getShare();
    Set<SMB2ShareAccess> s = new HashSet<>();
    s.add(SMB2ShareAccess.ALL.iterator().next());
    filename = filename.replace("//path base to ignore/","");
    return(share.openFile(filename, EnumSet.of(AccessMask.GENERIC_READ), null, s,  SMB2CreateDisposition.FILE_OPEN, null));
}

public static void releaseShare() throws Exception{

    share.close();
    session.close();
    connection.close();
    share = null;
    session = null;
    connection = null;

}
公共静态DiskShare getShare()引发异常
{
if(share==null){
SmbConfig cfg=SmbConfig.builder().withDfsEnabled(true.build();
SMBClient=新的SMBClient(cfg);
日志信息(“创建共享”);
connection=client.connect(sambaIP);
session=connection.authenticate(新的AuthenticationContext(sambaUsername,sambaPass.ToCharray(),sambaDomain));
share=(DiskShare)session.connectShare(sambaSharedName);
}
收益(份额);
}
公共静态文件打开(字符串文件名)引发异常{
getShare();
Set s=新的HashSet();
s、 添加(SMB2ShareAccess.ALL.iterator().next());
filename=filename.replace(“//path base to ignore/”,“”);
返回(share.openFile(文件名,EnumSet.of(AccessMask.GENERIC_READ),null,s,SMB2CreateDisposition.FILE_OPEN,null));
}
public static void releaseShare()引发异常{
share.close();
session.close();
connection.close();
share=null;
会话=空;
连接=空;
}

SmbClient本身也是可关闭的。不要忘记关闭它,以确保没有任何资源处于打开状态

无法在客户端上调用.close()或任何其他类似功能。。。它没有暴露。。那么客户端应该如何关闭?您使用的是0.8.0吗?在该版本中,我们在SMBClient上引入了
close()
方法以防止资源泄漏。我以为我使用的是0.8.0,我的POM中有它,但显然没有刷新,仍然使用0.7。。。刷新后,现在可以看到close()方法。。非常感谢。