jsch channel is not opened

本文详细记录了使用JSch库进行SSH连接时遇到的延迟问题及解决方案,同时探讨了Apache Commons VFS在处理SFTP文件类型判断时出现的异常情况,分析了可能的原因并提供了相应的解决思路。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Jsch使用的时候碰到一个问题, 调试后发现 ssh到服务器非常的卡, 建立查询服务器内存,可能是内存不够用了。

VFS同理。

Session created... com.jcraft.jsch.JSchException: channel is not opened. at com.jcraft.jsch.Channel.sendChannelOpen(Channel.java:765) at com.jcraft.jsch.Channel.connect(Channel.java:151) at com.jcraft.jsch.Channel.connect(Channel.java:145) at .application.ftp.SftpTemplate.getChannel(SftpTemplate.java:46) at

 org.apache.commons.vfs2.FileSystemException: Unknown message with code "Could not determine the type of file "sftp:///".".
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.refresh(SftpFileObject.java:83)
		at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:337)
		at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:300)
		at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:75)
		at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:55)
		at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:711)
		at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:648)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:498)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not determine the type of file "sftp:///".
		at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1291)
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.refresh(SftpFileObject.java:81)
		... 20 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp:///".
		at org.apache.commons.vfs2.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:127)
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:127)
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:97)
		at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1285)
		... 21 more
Caused by: com.jcraft.jsch.JSchException: channel is not opened.
		at com.jcraft.jsch.Channel.sendChannelOpen(Channel.java:765)
		at com.jcraft.jsch.Channel.connect(Channel.java:151)
		at com.jcraft.jsch.Channel.connect(Channel.java:145)
		at org.apache.commons.vfs2.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:101)
		... 24 more
.application.vfs.VfsWrapperException:  Caused by: Unknown message with code "Could not determine the type of file "sftp:///".". Caused by: Could not determine the type of file "sftp:///". Caused by: Could not connect to SFTP server at "sftp:///". Caused by: channel is not opened.
Caused by: org.apache.commons.vfs2.FileSystemException: Unknown message with code "Could not determine the type of file "sftp:///".".
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.refresh(SftpFileObject.java:83)
		at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:337)
		at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:300)
		at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:75)
		at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:55)
		at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:711)
		at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:648)
		... 13 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not determine the type of file "sftp:///".
		at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1291)
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.refresh(SftpFileObject.java:81)
		... 20 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp:///".
		at org.apache.commons.vfs2.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:127)
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:127)
		at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:97)
		at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1285)
		... 21 more
Caused by: com.jcraft.jsch.JSchException: channel is not opened.
		at com.jcraft.jsch.Channel.sendChannelOpen(Channel.java:765)
		at com.jcraft.jsch.Channel.connect(Channel.java:151)
		at com.jcraft.jsch.Channel.connect(Channel.java:145)
		at org.apache.commons.vfs2.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:101)
		... 24 more

转载于:https://my.oschina.net/u/3005325/blog/2086065

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值