Announcement Announcement Module
Collapse
No announcement yet.
Any changes in SI SFTP adapters in SI 2.1.0.RC1? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Any changes in SI SFTP adapters in SI 2.1.0.RC1?

    Hi,

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

    After the upgrade, my SFTP application is not working. The configuration is as following:
    Code:
    <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:int-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">
    ...
                     <int-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 am getting this error at startup
    Code:
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [sftp-example.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sftpSessionFactory' is defined
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    	... 24 more
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sftpSessionFactory' is defined
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)
    	at org.springframework.context.support.GenericApplicationContext.getBeanDefinition(GenericApplicationContext.java:301)
    	at org.springframework.integration.file.config.RemoteFileOutboundChannelAdapterParser.parseConsumer(RemoteFileOutboundChannelAdapterParser.java:50)
    	at org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser.parseAndRegisterConsumer(AbstractOutboundChannelAdapterParser.java:59)
    	at org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser.doParse(AbstractOutboundChannelAdapterParser.java:40)
    	at org.springframework.integration.config.xml.AbstractChannelAdapterParser.parseInternal(AbstractChannelAdapterParser.java:56)
    	at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
    	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
    	at org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler.parse(AbstractIntegrationNamespaceHandler.java:57)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1338)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
    	... 34 more
    The same configuration was working properly with SI 2.0.5.RELEASE but is not working with 2.1.0.RC1 dependencies. I am not able to figure out the issue, please help.

    Thanks in advance.
    Last edited by amitrnihar; Dec 5th, 2011, 02:22 AM.

  • #2
    The issue gets resoved if the beans used in the sftp outbound channel adapter are defined before its definition as:
    Code:
    <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. I would appreciate if somebody can help/guide me in identifying the actual cause.

    Thanks in advance.

    Comment


    • #3
      Could you please raise a bug in JIRA, I think i se what's going on.

      Comment


      • #4
        Thanks Oleg.

        I have raised a JIRA for this issue: https://jira.springsource.org/browse/INT-2297

        Comment

        Working...
        X