2014-10-29 55 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

相關問題