Saravanan Ramamoorthy
Saravanan Ramamoorthy

Reputation: 139

sftp:outbound-channel-adapter reject HostKey

I am trying to send the file to sftp using Spring Integration sftp outbound channel adapter.

<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'"/> 

I am getting the below error..

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)

I guess, I may have to set StrictHostKeyChecking to no, but how to set the value in sftp outbound gateway? Please provide your valuable suggestion.

Upvotes: 3

Views: 3224

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

Maybe this one:

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

Upvotes: 8

Related Questions