我嘗試從FTP服務器下載文件時遇到了一些問題。 當我嘗試將下載的文件保存到空文件夾時,一切正常,但當文件夾包含任何其他文件時,我的代碼甚至不會連接到服務器。 這是我的背景文件:使用彈簧集成下載文件
<bean id="ftpClientFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="${host}"/>
<property name="username" value="${user}"/>
<property name="password" value="${password}"/>
<property name="clientMode" value="0"/>
<property name="fileType" value="2"/>
<property name="bufferSize" value="10000000"/>
</bean>
<int:channel id="getFtpChannel">
<int:queue/>
</int:channel>
<int-ftp:inbound-channel-adapter local-directory="ftp/"
channel="getFtpChannel"
session-factory="ftpClientFactory"
remote-directory="./"
auto-create-local-directory="false"
delete-remote-files="true"
filename-pattern="*.exi">
<int:poller fixed-rate="10000"/>
</int-ftp:inbound-channel-adapter>
我的Java代碼:
public void receiveTest() {
ConfigurableApplicationContext context =
new FileSystemXmlApplicationContext("/src/citrus/resources/citrus-context.xml");
PollableChannel channel = context.getBean("getFtpChannel", PollableChannel.class);
channel.receive();
context.close();
}
測試通過,看起來一切正常,但它沒有。 你有什麼想法嗎? 感謝您的提前。
你的意思是它不從FTP下載文件,當你的本地dir'ftp /'不爲空時?嘗試顯示針對該糟糕情況的'org.springframework.integration'類的DEBUG日誌。 –
是的,那正是我的意思。我會嘗試獲取這些日誌,然後編輯我的帖子。 – mlethys