2014-10-29 103 views
3

我们使用FTP我们的项目:入站通道适配器轮询从FTP server.it在轮询之间的工作fine.But文件不working.when我看到FTP服务器日志我看到“425无法打开数据连接”。现在,当我重新启动或停止并启动ftp:inbound-channel-adapter时,它的轮询也会正常进行。这个问题反复出现以解决我需要停止/启动ftp的问题:inbound-channel-adapter.ftp:入站通道适配器在linux操作系统下运行。与FTP入站通道适配器FTP问题

现在用弹簧整合3只是为了更加明确我已经包括了XSD信息 (弹簧集成-3.0.xsd,弹簧集成-FTP-3.0.xsd)

没有任何特定的客户端模式我需要设置为FTP,即活动(本地/远程)/被动(本地/远程)等? 低于我的ftp:入站通道适配器配置

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> 
     <property name="host" value="abcd.com"/> 
     <property name="port" value="21"/> 
     <property name="username" value="userid"/> 
     <property name="password" value="password"/> 
    </bean> 

<int-ftp:inbound-channel-adapter id="ftpInbound" 
       channel="ftpChannel" 
       session-factory="ftpClientFactory" 
       auto-create-local-directory="true" 
       delete-remote-files="true" 
       remote-directory="/" 
       local-filename-generator-expression="new java.text.SimpleDateFormat('yyyy-MM-dd-hhmmssSSS').format(new java.util.Date()) + '.'+ #this" 
       local-directory="${ftp.sync.folder}" 
       remote-file-separator="/"> 
    </int-ftp:inbound-channel-adapter> 

所以不知道我可以在FTP server.but我喜欢看什么都没做有没有FTP的任何选项:入站通道适配器或任何东西你的家伙建议,以便每当FTP服务器抛出“425无法打开数据连接。”而不是手动停止/启动FTP:入站通道适配器有任何购股权或自动的方式,使这个work.Thanks上Spring的集成版本和ftp会话工厂

添加信息。

+0

非常好后请出示您的Spring集成版本,并添加您的会话工厂配置的问题。 – 2014-10-29 14:45:20

回答

1

有2种方式连接到FTP服务器的主动和被动模式。

ActiveMode:其中FTP服务器必须取得由客户所提到的端口数据连接

Passivemode (如果端口被防火墙阻止,您将获得425数据连接错误防火墙问题):当客户端与FTP服务器提到的端口建立数据连接。我们可以在FTP服务器上配置passvieports,并且使这些端口不被FTP服务器防火墙阻止。)

如果您未在ftpsessionfactory中指定任何clientmode,它将默认为活动模式,即clientMode = 0。 所以我有这将导致425数据连接issue.After我关闭防火墙其工作well.So现在我改变了我的FTPsessionfactory使用Passivemode所以FTP服务器,从来不计较客户端的防火墙

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> 
     <property name="host" value="abcd.com"/> 
     <property name="port" value="21"/> 
     <property name="username" value="userid"/> 
     <property name="password" value="password"/> 
<!-- 2 passive mode --> 
<property name="clientMode" value="2"/> 
</bean> 

这样,从来不计较防火墙问题关于客户端的防火墙。 有关FTP http://slacksite.com/other/ftp.html