1
votes

I have a simple ftp outbound gateway configured for ls, get, rm

    <int-ftp:outbound-gateway id="gatewayLS" 
    cache-sessions="false" 
    session-factory="incomingCachingSessionFactory"
    request-channel="inboundChannel" 
    command="ls" 
    command-options="-1" 
    expression="'${ftp.pull.remote.directory}'"
    reply-channel="toSplitter" />

<channel id="toSplitter">
    <interceptors>
        <wire-tap channel="logger" />
    </interceptors>
</channel>

<logging-channel-adapter id="logger"
    log-full-message="true" level="DEBUG" />

<splitter id="splitter" input-channel="toSplitter"
    output-channel="toGet" />

<int-ftp:outbound-gateway id="gatewayGET"
    cache-sessions="false"
    local-directory="${ftp.pull.local.directory}"
    session-factory="incomingCachingSessionFactory" 
    request-channel="toGet"
    reply-channel="downloadedFileChannel" 
    command="get" 
    command-options="-P"
    expression="headers['file_remoteDirectory'] + '/' + payload" />

this works perfectly on my development windows box, connecting to multiple different FTP servers.

and my log outputs expected

DEBUG: org.springframework.integration.ftp.session.DefaultFtpSessionFactory - Connected to server [ftp.domain.com:21]
DEBUG: org.springframework.integration.ftp.gateway.FtpOutboundGateway - handler 'org.springframework.integration.ftp.gateway.FtpOutboundGateway#0' sending reply Message: [Payload=[test_file.zip]][Headers={timestamp=1343143242030, id=56758ef9-57e5-43d6-b8b7-c36539d9fd0d, file_remoteDirectory=/images/}]

the time bewteen the "Connected to server" and "sending reply Message" is also pretty much instantaneous

however, once deployed to 2x Centos servers (5.8 and 6.2), the reply channel of the LS is always emtpy e.g.

DEBUG: org.springframework.integration.ftp.session.DefaultFtpSessionFactory - Connected to server [ftp.domain.com:21]
DEBUG: org.springframework.integration.ftp.gateway.FtpOutboundGateway - handler 'org.springframework.integration.ftp.gateway.FtpOutboundGateway#0' sending reply Message: [Payload=[]][Headers={timestamp=1343143961046, id=31759d6f-201e-4028-8943-0a68ae64db81, file_remoteDirectory=/images/}]

the time between the "Connected to server" and "sending reply Message" is also abnormally long.

some more info:

  • all 3 machines are using maven to build the WAR from the same code base.

  • the 2 centos machines are in different datacentres

  • I have tried multiple different unrelated FTP servers, with the same results

  • there are definately files on the ftp server

  • the ftp servers are accessable on the centos boxes, confirmed using "ncftp" and "ftp"

I know this post is pretty vague, but it is driving me nuts. any thoughts greatly appreciated

1

1 Answers

1
votes

I had to set <property name="clientMode" value="2" /> on my DefaultFtpSessionFactory