Hi together,

i pretty much followed the example provided in spring examples for the sftp stuff. But I have the problem that the outbound adapter does not connect to the remote host.

Here is my config

Code:
<int:channel id="ftpOutbound"/>
    
    <beans:bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
        <beans:property name="host" value="192.168.1.28"/>
        <beans:property name="port" value="22"/>
        <beans:property name="user" value="esm"/>
        <beans:property name="password" value="esm"/>
    </beans:bean>
    
    <int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
                                       session-factory="sftpSessionFactory"
                                       channel="ftpOutbound"
                                       remote-directory="/home/esm/upload/"
                                       remote-filename-generator-expression="'foo'"/>
And this is the controller class which I use to create a message and send it to the channel.

Code:
@Controller
@RequestMapping(value = "/StartTesting/*")
public class StartTesting {
    
    @Autowired
    private MessageChannel ftpOutbound;
    
    @RequestMapping(value = "Run", method = RequestMethod.GET)
    @ResponseBody
    public String run(HttpServletRequest request) {
        
//        String s = "HelloremoteServer";
        File f = new File("test.txt");
        Message<File> message = MessageBuilder.withPayload(f).build();
        ftpOutbound.send(message);
        return "Done";
        
    }

}
Here is what the logging shows me:
Code:
20:44:30,664 DEBUG DispatcherServlet:912 - Last-Modified value for [/ArkadonQueueProducer/StartTesting/Run] is: -1
20:44:30,675 DEBUG DirectChannel:224 - preSend on channel 'ftpOutbound', message: [Payload=test.txt][Headers={timestamp=1362080670675, id=588afa41-be54-419d-8d9a-51cd624223e6}]
20:44:30,676 DEBUG FileTransferringMessageHandler:67 - org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0 received message: [Payload=test.txt][Headers={timestamp=1362080670675, id=588afa41-be54-419d-8d9a-51cd624223e6}]
20:44:30,676 DEBUG DirectChannel:237 - postSend (sent=true) on channel 'ftpOutbound', message: [Payload=test.txt][Headers={timestamp=1362080670675, id=588afa41-be54-419d-8d9a-51cd624223e6}]
20:44:30,682 DEBUG RequestResponseBodyMethodProcessor:150 - Written [Done] as "text/html" using [org.springframework.http.converter.StringHttpMessageConverter@63226d58]

As you can see i commented out the String variable in the controller. If I would use the String payload instead of the file payload the log file would show me this:

Code:
20:31:23,586 DEBUG DispatcherServlet:912 - Last-Modified value for [/ArkadonQueueProducer/StartTesting/Run] is: -1
20:31:23,598 DEBUG DirectChannel:224 - preSend on channel 'ftpOutbound', message: [Payload=HelloremoteServer][Headers={timestamp=1362079883598, id=d39dd603-ef9e-4245-9fb8-5950658292b5}]
20:31:23,599 DEBUG FileTransferringMessageHandler:67 - org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0 received message: [Payload=HelloremoteServer][Headers={timestamp=1362079883598, id=d39dd603-ef9e-4245-9fb8-5950658292b5}]
20:31:23,639  INFO jsch:52 - Connecting to 192.168.1.28 port 22
20:31:23,642  INFO jsch:52 - Connection established
...
...
...
20:31:23,953  INFO jsch:52 - Authentications that can continue: password
20:31:23,953  INFO jsch:52 - Next authentication method: password
20:31:23,964  INFO jsch:52 - Authentication succeeded (password).
20:31:24,225 DEBUG SimplePool:182 - Obtained new org.springframework.integration.sftp.session.SftpSession@3d35f763.
20:31:24,227 DEBUG CachingSessionFactory:109 - Releasing Session back to the pool.
20:31:24,227 DEBUG SimplePool:210 - Releasing org.springframework.integration.sftp.session.SftpSession@3d35f763 back to the pool
20:31:24,228 DEBUG ExceptionHandlerExceptionResolver:132 - Resolving exception from handler [public java.lang.String de.arkadon.arkadonqueueproducer.StartTesting.run(javax.servlet.http.HttpServletRequest)]: org.springframework.integration.MessageDeliveryException: Error handling message for file [/opt/tomcat6/temp/foo.tmp]
20:31:24,231 DEBUG ResponseStatusExceptionResolver:132 - Resolving exception from handler [public java.lang.String de.arkadon.arkadonqueueproducer.StartTesting.run(javax.servlet.http.HttpServletRequest)]: org.springframework.integration.MessageDeliveryException: Error handling message for file [/opt/tomcat6/temp/foo.tmp]
20:31:24,231 DEBUG DefaultHandlerExceptionResolver:132 - Resolving exception from handler [public java.lang.String de.arkadon.arkadonqueueproducer.StartTesting.run(javax.servlet.http.HttpServletRequest)]: org.springframework.integration.MessageDeliveryException: Error handling message for file [/opt/tomcat6/temp/foo.tmp]
20:31:24,234 DEBUG DispatcherServlet:943 - Could not complete request
The question for me is now: Why does spring only initiate the ssh protocal handshake with my server when using the String payload whereas there is no error with the file payload but on the other hand no file on my remote server!
The best thing is, if I use FileZilla to connect to my sftp remote host, everything works fine. I can upload and download files as normal so password, username, hostname or any other credentials should be a problem.

Any help would be greatly appreciated!!!

Cheers and thanks in advance to the community
Peter