sftp:outbound-通道适配器拒绝 HostKey

sftp:outbound-channel-adapter reject HostKey

我正在尝试使用 Spring 集成 sftp 出站通道适配器将文件发送到 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 the allowUnknownKeys property is true (default false).

http://docs.spring.io/spring-integration/reference/html/whats-new.html#_default_sftp_session_factory