title: Error using Spring Integration
body: <p>I need to create an application that transfers files from local to remote SFTP server. I have to do it using Spring Integration, I followed the documentation but I have not been able to make it works. When I run it always get the error:</p>
  
  <pre><code>    may 15, 2017 12:15:37 PM com.test.tt.file.sftp.out.SftpFileManager main
      SEVERE: exporting...
      may 15, 2017 12:15:37 PM com.test.tt.file.sftp.out.SftpFileManager exportFile
      INFO: &lt;&lt;&lt; at SftpFileManager.exportFile &gt;&gt;&gt;
      may 15, 2017 12:15:37 PM com.test.tt.file.sftp.out.SftpFileManager exportFile
      INFO: SftpFileManager.localDirectory =&gt; C:\temp\test\test.xml
      may 15, 2017 12:15:37 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
      INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@351787ea: startup date [Mon May 15 12:15:37 CDT 2017]; root of context hierarchy
      may 15, 2017 12:15:37 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
      INFO: Loading XML bean definitions from class path resource [META-INF/spring/integration/SftpFileManager-context.xml]
      may 15, 2017 12:15:37 PM org.springframework.beans.factory.config.PropertiesFactoryBean loadProperties
      INFO: Loading properties file from URL [jar:file:/C:/Users/user/.m2/repository/org/springframework/integration/spring-integration-core/4.1.6.RELEASE/spring-integration-core-4.1.6.RELEASE.jar!/META-INF/spring.integration.default.properties]
      may 15, 2017 12:15:37 PM org.springframework.integration.config.IntegrationRegistrar registerHeaderChannelRegistry
      INFO: No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
      may 15, 2017 12:15:38 PM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
      INFO: Loading properties file from class path resource [sftp.properties]
      may 15, 2017 12:15:38 PM org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor registerErrorChannel
      INFO: No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
      may 15, 2017 12:15:38 PM org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor registerTaskScheduler
      INFO: No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
      may 15, 2017 12:15:38 PM org.springframework.beans.factory.config.PropertiesFactoryBean loadProperties
      INFO: Loading properties file from URL [jar:file:/C:/Users/user/.m2/repository/org/springframework/integration/spring-integration-core/4.1.6.RELEASE/spring-integration-core-4.1.6.RELEASE.jar!/META-INF/spring.integration.default.properties]
      may 15, 2017 12:15:38 PM org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler initialize
      INFO: Initializing ExecutorService  'taskScheduler'
      may 15, 2017 12:15:38 PM org.springframework.context.support.DefaultLifecycleProcessor start
      INFO: Starting beans in phase -2147483648
      may 15, 2017 12:15:38 PM org.springframework.context.support.DefaultLifecycleProcessor start
      INFO: Starting beans in phase 0
      may 15, 2017 12:15:38 PM org.springframework.integration.endpoint.EventDrivenConsumer logComponentSubscriptionEvent
      INFO: Adding {message-handler:sftpOutboundAdapter} as a subscriber to the 'inputChannel' channel
      may 15, 2017 12:15:38 PM org.springframework.integration.channel.DirectChannel adjustCounterIfNecessary
      INFO: Channel 'org.springframework.context.support.ClassPathXmlApplicationContext@351787ea.inputChannel' has 1 subscriber(s).
      may 15, 2017 12:15:38 PM org.springframework.integration.endpoint.EventDrivenConsumer start
      INFO: started sftpOutboundAdapter
      may 15, 2017 12:15:38 PM org.springframework.integration.endpoint.EventDrivenConsumer logComponentSubscriptionEvent
      INFO: Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
      may 15, 2017 12:15:38 PM org.springframework.integration.channel.PublishSubscribeChannel adjustCounterIfNecessary
      INFO: Channel 'org.springframework.context.support.ClassPathXmlApplicationContext@351787ea.errorChannel' has 1 subscriber(s).
      may 15, 2017 12:15:38 PM org.springframework.integration.endpoint.EventDrivenConsumer start
      INFO: started _org.springframework.integration.errorLogger
      may 15, 2017 12:15:38 PM com.jcraft.jsch log
      INFO: Connecting to REMOTE.IP port 22
      may 15, 2017 12:15:38 PM com.jcraft.jsch log
      INFO: Connection established
      may 15, 2017 12:15:38 PM com.jcraft.jsch log
      INFO: Remote version string: SSH-2.0-OpenSSH_4.3
      may 15, 2017 12:15:38 PM com.jcraft.jsch log
      INFO: Local version string: SSH-2.0-JSCH-0.1.52
      may 15, 2017 12:15:38 PM com.jcraft.jsch log
      INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: aes256-ctr is not available.
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: aes192-ctr is not available.
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: aes256-cbc is not available.
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: aes192-cbc is not available.
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: diffie-hellman-group14-sha1 is not available.
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXINIT sent
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXINIT received
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: ssh-rsa,ssh-dss
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: none,zlib@openssh.com
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: none,zlib@openssh.com
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: 
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server: 
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: none
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: none
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: 
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client: 
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: server-&gt;client aes128-ctr hmac-md5 none
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: kex: client-&gt;server aes128-ctr hmac-md5 none
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXDH_INIT sent
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: expecting SSH_MSG_KEXDH_REPLY
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: ssh_rsa_verify: signature true
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      WARNING: Permanently added 'REMOTE.IP' (RSA) to the list of known hosts.
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_NEWKEYS sent
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_NEWKEYS received
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_SERVICE_REQUEST sent
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: SSH_MSG_SERVICE_ACCEPT received
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: Authentications that can continue: gssapi-with-mic,publickey,keyboard-interactive,password
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: Next authentication method: gssapi-with-mic
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: Authentications that can continue: publickey,keyboard-interactive,password
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: Next authentication method: publickey
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: Authentications that can continue: password
      may 15, 2017 12:15:39 PM com.jcraft.jsch log
      INFO: Next authentication method: password
      may 15, 2017 12:15:52 PM com.jcraft.jsch log
      INFO: Disconnecting from REMOTE.IP port 22
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Connecting to REMOTE.IP port 22
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Connection established
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Remote version string: SSH-2.0-OpenSSH_4.3
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Local version string: SSH-2.0-JSCH-0.1.52
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: aes256-ctr is not available.
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: aes192-ctr is not available.
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: aes256-cbc is not available.
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: aes192-cbc is not available.
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: diffie-hellman-group14-sha1 is not available.
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXINIT sent
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXINIT received
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: ssh-rsa,ssh-dss
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: none,zlib@openssh.com
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: none,zlib@openssh.com
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: 
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server: 
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: none
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: none
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: 
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client: 
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: server-&gt;client aes128-ctr hmac-md5 none
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: kex: client-&gt;server aes128-ctr hmac-md5 none
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXDH_INIT sent
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: expecting SSH_MSG_KEXDH_REPLY
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: ssh_rsa_verify: signature true
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Host 'REMOTE.IP' is known and matches the RSA host key
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_NEWKEYS sent
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_NEWKEYS received
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_SERVICE_REQUEST sent
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: SSH_MSG_SERVICE_ACCEPT received
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Authentications that can continue: gssapi-with-mic,publickey,keyboard-interactive,password
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Next authentication method: gssapi-with-mic
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Authentications that can continue: publickey,keyboard-interactive,password
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Next authentication method: publickey
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Authentications that can continue: password
      may 15, 2017 12:15:53 PM com.jcraft.jsch log
      INFO: Next authentication method: password
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: Disconnecting from REMOTE.IP port 22
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: Connecting to REMOTE.IP port 22
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: Connection established
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: Remote version string: SSH-2.0-OpenSSH_4.3
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: Local version string: SSH-2.0-JSCH-0.1.52
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: aes256-ctr is not available.
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: aes192-ctr is not available.
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: aes256-cbc is not available.
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: aes192-cbc is not available.
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: diffie-hellman-group14-sha1 is not available.
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXINIT sent
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXINIT received
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: ssh-rsa,ssh-dss
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: none,zlib@openssh.com
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: none,zlib@openssh.com
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: 
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server: 
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: none
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: none
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: 
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client: 
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: server-&gt;client aes128-ctr hmac-md5 none
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: kex: client-&gt;server aes128-ctr hmac-md5 none
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_KEXDH_INIT sent
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: expecting SSH_MSG_KEXDH_REPLY
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: ssh_rsa_verify: signature true
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: Host 'REMOTE.IP' is known and matches the RSA host key
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_NEWKEYS sent
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_NEWKEYS received
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_SERVICE_REQUEST sent
      may 15, 2017 12:16:07 PM com.jcraft.jsch log
      INFO: SSH_MSG_SERVICE_ACCEPT received
      may 15, 2017 12:16:08 PM com.jcraft.jsch log
      INFO: Authentications that can continue: gssapi-with-mic,publickey,keyboard-interactive,password
      may 15, 2017 12:16:08 PM com.jcraft.jsch log
      INFO: Next authentication method: gssapi-with-mic
      may 15, 2017 12:16:08 PM com.jcraft.jsch log
      INFO: Authentications that can continue: publickey,keyboard-interactive,password
      may 15, 2017 12:16:08 PM com.jcraft.jsch log
      INFO: Next authentication method: publickey
      may 15, 2017 12:16:08 PM com.jcraft.jsch log
      INFO: Authentications that can continue: password
      may 15, 2017 12:16:08 PM com.jcraft.jsch log
      INFO: Next authentication method: password
      may 15, 2017 12:16:20 PM com.jcraft.jsch log
      INFO: Disconnecting from REMOTE.IP port 22
      may 15, 2017 12:16:20 PM com.test.tt.file.sftp.out.SftpFileManager exportFile
      SEVERE: org.springframework.messaging.MessagingException: ; nested exception is org.springframework.messaging.MessagingException: Failed to obtain pooled item; nested exception is java.lang.IllegalStateException: failed to create SFTP Session
  </code></pre>
  
  <p>I checked the credentials but that is not the problem. Could you please help me? or share me an example?</p>
  
  <p>My configuration:
  <strong>SftpFileManager-context.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:int="http://www.springframework.org/schema/integration"
          xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
          xmlns:context="http://www.springframework.org/schema/context"
          xsi:schemaLocation="http://www.springframework.org/schema/beans 
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/integration 
              http://www.springframework.org/schema/integration/spring-integration.xsd
              http://www.springframework.org/schema/integration/sftp 
              http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context.xsd
              "
              &gt;
  
           &lt;!-- &lt;import resource="SftpCommon.xml"/&gt;  --&gt; 
  
          &lt;context:property-placeholder location="classpath:sftp.properties"/&gt;
  
          &lt;bean id="sftpSessionFactory" class="org.springframework.integration.file.remote.session.CachingSessionFactory"&gt;
              &lt;constructor-arg ref="defaultsftpSessionFactory" /&gt;
              &lt;property name="poolSize" value="${poolSize}"/&gt;
              &lt;property name="sessionWaitTimeout" value="${sessionWaitTimeout}"/&gt;
          &lt;/bean&gt;
  
          &lt;bean id="sftpFileManager" class="com.test.tt.file.sftp.out.SftpFileManager" /&gt;
  
          &lt;bean id="defaultsftpSessionFactory"
                  class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"&gt;
              &lt;property name="host" value="${host}"/&gt;
              &lt;property name="port" value="${port}"/&gt;
              &lt;property name="user" value="${username}"/&gt;
              &lt;property name="password" value="${password}"/&gt;
  
              &lt;!--  &lt;property name="allowUnknownKeys" value="true"/&gt; --&gt;
          &lt;/bean&gt;
  
          &lt;int:channel id="inputChannel"/&gt;
  
          &lt;int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
                      session-factory="sftpSessionFactory"
                      channel="inputChannel"
                      remote-file-separator="/"
                      remote-directory="${remote.directory}"
                      mode="REPLACE"&gt;
              &lt;int-sftp:request-handler-advice-chain&gt;
                  &lt;!-- &lt;bean class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice" &gt;
                      &lt;property name="retryPolicy"&gt;
                          &lt;bean class="org.springframework.retry.policy.SimpleRetryPolicy"&gt;
                              &lt;property name="maxAttempts" value="${retry.maxAttempts}" /&gt;
                          &lt;/bean&gt;
                      &lt;/property&gt;
                  &lt;/bean&gt; --&gt;
                  &lt;int:retry-advice /&gt;
              &lt;/int-sftp:request-handler-advice-chain&gt;
          &lt;/int-sftp:outbound-channel-adapter&gt;
  
          &lt;bean id="fileNameGenerator" class="org.springframework.integration.file.DefaultFileNameGenerator" /&gt;
  
          &lt;bean id="SftpFileManager" class="com.test.tt.file.sftp.out.SftpFileManager"&gt;
            &lt;property name="inputChannel" ref="inputChannel" /&gt;
          &lt;/bean&gt; 
      &lt;/beans&gt;
  </code></pre>
  
  <p><strong>My class SftpFileManager.java</strong></p>
  
  <pre><code>    public class SftpFileManager {
  
  
          protected static Log log = LogFactory.getLog(SftpFileManager.class);
          private MessageChannel inputChannel;
  
  
          public boolean exportFile(String pathName) throws Exception {
  
              log.info("&lt;&lt;&lt; at SftpFileManager.exportFile &gt;&gt;&gt;");
  
              log.info("SftpFileManager.localDirectory =&gt; " + pathName);
  
              final ApplicationContext context = new ClassPathXmlApplicationContext(
                      "/META-INF/spring/integration/SftpFileManager-context.xml");
  
              try {
                  final File file = new File(pathName);
                  Assert.isTrue(file.exists(), String.format("File '%s' does not exist.", pathName));
                  final Message&lt;File&gt; message = MessageBuilder.withPayload(file).build();
                  inputChannel = context.getBean("inputChannel", MessageChannel.class);
                  inputChannel.send(message); 
  
                  log.info(String.format("Successfully transferred '%s' file to a " + " server under the name '%s'",
                          pathName, pathName));
              } catch (Exception ex) {
  
                  log.error(ex);
  
              } finally {
  
              }
  
              return false;
          }
  
          public static void main(String [] args){
  
              try{
              SftpFileManager sftp = new SftpFileManager();
              log.error("exporting...");
              sftp.exportFile("C:\\temp\\test\\test.xml");
  
              }catch(Exception ex){
                  log.error("SftpFileManageraa.Error!!!!!!!!!!!" + ex);
              }
          }
  
          public MessageChannel getInputChannel() {
              return inputChannel;
          }
  
          public void setInputChannel(MessageChannel inputChannel) {
              this.inputChannel = inputChannel;
          }
  
      }
  </code></pre>