我尝试从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