spring-integration - sftp:outbound-channel-adapter 拒绝 HostKey

标签 spring-integration sftp

我正在尝试使用 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 the allowUnknownKeys property is true (default false).

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/

相关文章:

java - JSch算法协商失败

java - Unix Copy & JSch 命令在 SFTP 时产生冲突

java - 在 Spring Integration 中将 MessageHeader 的键设置为 'NEW' 时出现 SpelParseException

java - Http 出站网关正在工作但未调用电话 - 使用 spring 集成 DSL java

java - Spring 集成和 Kafka 消费者 : Stop message-driven-channel-adapter right after records are sucessfully fetched

java - 列出远程服务器目录中的文件名

ubuntu - 如何在 Cyber​​Duck 中通过 SFTP 使用 sudo?

java - 使用java将图像保存到SFTP服务器

java - 以我们需要多次创建相同上下文的方式设计 Spring 应用程序是最佳实践吗?

c# - 在 C# 中使用 SFTP 时的线程最佳实践