Announcement Announcement Module
Collapse
No announcement yet.
SFTP upload giving failed to create FTPClient message. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SFTP upload giving failed to create FTPClient message.

    Hi,

    My trying to upload files using SFTP spring integration.
    I tried this on my localnetwork and it worked fine.But after deployment got the following message:

    Code:
    org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0]
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:79)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:114)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:101)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    	at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    	at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:175)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:159)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:124)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:114)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:100)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:114)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:101)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
    	at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65)
    	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51)
    	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.IllegalStateException: failed to create FTPClient
    	at org.springframework.integration.ftp.session.AbstractFtpSessionFactory.getSession(AbstractFtpSessionFactory.java:132)
    	at org.springframework.integration.file.remote.session.CachingSessionFactory.doGetSession(CachingSessionFactory.java:98)
    	at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:77)
    	at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.handleMessageInternal(FileTransferringMessageHandler.java:128)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    	... 36 more
    Caused by: org.apache.commons.net.MalformedServerReplyException: Could not parse response code.
    Server Reply: SSH-1.99-OpenSSH_4.3
    
    	at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:333)
    	at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:290)
    	at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:396)
    	at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:796)
    	at org.apache.commons.net.SocketClient.connect(SocketClient.java:172)
    	at org.apache.commons.net.SocketClient.connect(SocketClient.java:192)
    	at org.springframework.integration.ftp.session.AbstractFtpSessionFactory.createClient(AbstractFtpSessionFactory.java:145)
    	at org.springframework.integration.ftp.session.AbstractFtpSessionFactory.getSession(AbstractFtpSessionFactory.java:129)
    	... 40 more
    My config is as follows:

    Code:
    <int:splitter input-channel="splitterChannel"
    		output-channel="ftpChannel" />
    
    	<int-sftp:outbound-channel-adapter id="ftpOutbound"
    				session-factory="ftpClientFactory"
    				channel="ftpChannel"
    				charset="UTF-8"
    				remote-directory="/home/test-sftp/"/>
    
    <int:gateway id="ftpGateway" default-request-channel="ftplsChannel"
    		service-interface="com.test.ftp.ToFtpGateway" />
    
    	<int-sftp:outbound-gateway command="ls"
    		session-factory="ftpClientFactory" expression="payload"
    		request-channel="ftplsChannel"   />
    
    	<bean id="ftpClientFactory"
    		class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
    		<property name="host" value="myhost" />
    		<property name="port" value="22" />
    		<property name="user" value="username" />
    		<property name="password" value="password" />
    	</bean>
    Please help.I am using sftpClientFactory, and Spring Integration 2.1
    Thanks in advance
    Regards,
    Annuk

  • #2
    Hi,

    The configurations were wrong at my side.
    Had used ftp client factory instead of sftp.

    Thanks.
    Regards
    Annuk

    Comment

    Working...
    X