0

我正在尝试从 FTP 复制文件并希望将其放置在本地计算机中。

为此,我创建了一个入站通道配置:

<bean name="publishStockSessionFactory"
      class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
  <property name="host"
        value="10.255.255.1" />
<property name="port" value="21" />
    <property name="username"
        value="test" />
    <property name="password"
        value="test" />
</bean>

<bean id="stockLocalDirectory" class="java.lang.String">
    <constructor-arg
        value="/opt/test" />
</bean>

<bean id="stockRemoteDirectory" class="java.lang.String">
    <constructor-arg
        value="stock" />
</bean>

<int-ftp:inbound-channel-adapter 
     local-directory="# {stockLocalDirectory}"             
     channel="stockFilesFromFTP"  
     session-factory="publishStockSessionFactory" 
     remote-directory="#{stockRemoteDirectory}" 
     delete-remote-files="true" 
     filename-regex="Stock*.csv" >
    <int:poller fixed-rate="120000" max-messages-per-poll="100" />
</int-ftp:inbound-channel-adapter>

<int:publish-subscribe-channel id="stockFilesFromFTP" />

启动时出现的错误是

INFO   | jvm 1    | main    | 2013/01/15 22:20:02.715 | 2013-01-15 22:20:02,699 
ERROR  task-scheduler-4     ErrorHandler            : failed to send message 
to  channel 'stockFilesFromFTP' within timeout: -1

我们打开的调试是

log4j.logger.org.springframework.aop=DEBUG
org.springframework.integration.channel.DirectChannel=DEBUG
org.springframework.integration.channel.MessagePublishingErrorHandler=DEBUG
org.springframework.integration.config.xml.PointToPointChannelParser=DEBUG

你能建议我如何调试这个错误吗?

4

2 回答 2

0

我对 FTPclientfactory bean 使用了以下类型的配置。它也有超时参数,因此如果您因连接超时而遇到问题,这将对您有所帮助。

<bean id="testapp.standardFTPClientFactory" class="org.springframework.integration.ftp.DefaultFTPClientFactory"
        abstract="true">
        <property name="host" value="${ftp.host}"/>
        <property name="username" value="${ftp.username}"/>
        <property name="password" value="${ftp.password}"/>
        <property name="port" value="${ftp.port}"/>
        <property name="remoteWorkingDirectory" value="${ftp.remotedir}"/>
        <property name="dataTimeout" value="3600000"/>
        <property name="connectTimeout" value="${ftp.connectTimeout}"/>
        <property name="clientMode" value="2"/>
</bean>
于 2013-01-18T13:47:31.007 回答
0

使用调试级别日志记录运行。

您必须在频道上至少有一位订阅者stockFilesFromFTP

于 2013-01-15T20:44:37.697 回答