我正在尝试使用 Spring Integration sftp 出站 channel 适配器将文件发送到 sftp。
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter" session-factory="sftpSessionFactory"channel="sftpChannel" charset="UTF-8" remote-directory="/sftp/home/sftp_foler" remote-filename-generator-expression="'dummy.txt'"/>
我收到以下错误..
Caused by: java.lang.IllegalStateException: failed to connect
at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:272)
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:377)
... 42 more
Caused by: com.jcraft.jsch.JSchException: reject HostKey: myHost
at com.jcraft.jsch.Session.checkHost(Session.java:791)
at com.jcraft.jsch.Session.connect(Session.java:342)
at com.jcraft.jsch.Session.connect(Session.java:183)
at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:263)
我想,我可能必须将 StrictHostKeyChecking 设置为 no,但是如何在 sftp 出站网关中设置该值? 请提出您的宝贵建议。
最佳答案
也许这个:
Previously, the
DefaultSftpSessionFactory
unconditionally allowed connections to unknown hosts. This is now configurable (default false).The factory now requires a configured
knownHosts
file unless theallowUnknownKeys
property istrue
(defaultfalse
).
http://docs.spring.io/spring-integration/reference/html/whats-new.html#_default_sftp_session_factory
关于spring-integration - sftp:outbound-channel-adapter 拒绝 HostKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36357040/