023-8-30 13:50:39 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
jcifs.smb.SmbException: Failed to connect: 0.0.0.0<00>/192.168.3.250
jcifs.util.transport.TransportException: Connection timeout
解决方案:
查询jcifs的网站(JCIFS)
上述部分明确提到了,jsifs仅支持SMB1,而不支持SMB2/SMB3,所以先从服务器支持协议入手
服务器为windows服务器,在服务器上打开powershell控制台(在开始->运行->输入 powershell即可)
获取 SMB1和SMB2 服务器协议配置的当前状态,输入:
Get-SmbServerConfiguration | Select EnableSMB1Protocol, EnableSMB2Protocol
解决问题
方案一:
当前解决思路为替换jar包(如果有更好的方式,欢迎私信)
jcifs的网站上提供了两种支持SMB2/SMB3的方式
当前解决时选用的方式为smbj(github地址:https://github.com/hierynomus/smbj)
第一步: 下载jar包,可以去https://mvnrepository.com/search下载(只能下载smbj.jar包,在实际运行时还需要导入一些辅助jar包,具体参照github上的gradle.properties),也可以去我上传的资源:https://download.csdn.net/download/u013092293/10766117进行下载(内附所需的jar包和一个demo)
第二步: 参照github官方的文档进行编写代码,链接共享文件夹
实测成功
方案二:
文章原作者链接如下,转载仅用于个人错误笔记