【发布时间】:2014-07-14 13:33:38
【问题描述】:
当我尝试从 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/不为空时,您的意思是它不会从FTP 下载文件吗?尝试为该不良情况显示org.springframework.integration类别的调试日志。 -
是的,这正是我的意思。我会尝试获取这些日志,然后我会编辑我的帖子。
标签: java xml ftp spring-integration