【发布时间】:2021-01-29 08:26:18
【问题描述】:
我有一个具有这种目录结构的 sftp 服务器:
main
--directoryA
--subDirectory1
--directoryB
--subDirectory1
但是当我尝试使用 sftp 出站网关获取目录列表时,我收到了这个错误:
Caused by: com.jcraft.jsch.SftpException: main/directoryA/directoryA/subDirectory1
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2225) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2242) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1592) ~[jsch-0.1.55.jar:na]
at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1553) ~[jsch-0.1.55.jar:na]
at org.springframework.integration.sftp.session.SftpSession.list(SftpSession.java:111) ~[spring-integration-sftp-5.3.3.RELEASE.jar:5.3.3.RELEASE]
... 47 common frames omitted
我不确定为什么 directoryA 会追加两次。这是我的出站网关:
<int-sftp:outbound-gateway id="gateway"
expression="payload"
request-channel="request"
remote-directory="main"
command-options="-dirs -R"
command="ls"
session-factory="sessionFactory"
reply-channel="reply">
</int-sftp:outbound-gateway>
【问题讨论】:
-
您是否尝试过例如。没有递归列表?或提供具有绝对路径的目录,如“/main”
-
是的,没有递归它只返回主目录上的文件。我还需要检查所有子目录路径。我还尝试给出该绝对路径“/main”。仍然出现此错误。
-
你发送到这个网关的消息的负载是什么?
-
标签: spring spring-integration sftp