Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-2297

SI 2.1.0.RC1 sftp:outbound-channel-adapter needs the DefaultSftpSessionFactory bean definition declared before its own defintion

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 2.1 RC1
    • Fix Version/s: 2.1 RC2
    • Component/s: Adapters
    • Labels:
      None

      Description

      I recently upgraded my project's SI dependencies from 2.0.5.RELEASE to 2.1.0.RC1.

      After the upgrade, my SFTP application with following configuration, which was working with SI 2.0.5.RELEASE dependencies, fails to load:

      <beans:beans xmlns="http://www.springframework.org/schema/integration"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      	xmlns:beans="http://www.springframework.org/schema/beans"
      	xmlns:file="http://www.springframework.org/schema/integration/file"
      	xmlns:stream="http://www.springframework.org/schema/integration/stream"
      	xmlns:sftp="http://www.springframework.org/schema/integration/sftp"
      	xmlns:util="http://www.springframework.org/schema/util"
      	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.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/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
      	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
      ...
                       <sftp:outbound-channel-adapter id="sftpOutboundAdapter"
      				session-factory="sftpSessionFactory"
      				channel="ftpOutChannel"
      				charset="UTF-8"
      				remote-directory="${test.remotedir}"
      				remote-filename-generator-expression="'out_' + getHeaders().get(T(org.springframework.integration.file.FileHeaders).FILENAME)"/>
                   <beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
      		<beans:property name="host" value="localhost"/>
      		<beans:property name="privateKey" value="file:${test.keyfile}"/>
      		<beans:property name="port" value="22"/>
      		<beans:property name="user" value="${test.username}"/>
      		<beans:property name="sessionConfig" ref="sessionConfig"/>
                   </beans:bean>
      	
      	<util:properties id="sessionConfig">
      		<beans:prop key="StrictHostKeyChecking">no</beans:prop>
      	</util:properties>
      ...
      

      While trying to run this application,I get org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sftpSessionFactory' is defined.

      However, if I define the DefaultSftpSessionFactory bean before the sftp:outbound-channel-adapter definition, as following, the application works fine:

      ...
             <beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
      		<beans:property name="host" value="localhost"/>
      		<beans:property name="privateKey" value="file:${test.keyfile}"/>
      		<beans:property name="port" value="22"/>
      		<beans:property name="user" value="${test.username}"/>
      		<beans:property name="sessionConfig" ref="sessionConfig"/>
      	</beans:bean>
      	
      	<util:properties id="sessionConfig">
      		<beans:prop key="StrictHostKeyChecking">no</beans:prop>
      	</util:properties>
      	
      	<sftp:outbound-channel-adapter id="sftpOutboundAdapter"
      				session-factory="sftpSessionFactory"
      				channel="ftpOutChannel"
      				charset="UTF-8"
      				remote-directory="${test.remotedir}"
      				remote-filename-generator-expression="'out_' + getHeaders().get(T(org.springframework.integration.file.FileHeaders).FILENAME)"/>
      ...
      

      Not sure why and how the upgrading to 2.1.0.RC1 is related to this.

        Attachments

          Activity

            People

            • Assignee:
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
              Reporter:
              nrochan Nihar Rochan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: