sftp:inbound-streaming-channel-adapter with zookeeper 在我使用 C



我已经将sftp:inbound-streaming-channel-adapter与zookeeper一起使用,但它给了我例外:java.lang.ClassCastException:com.jcraft.jsch.ChannelSftp$LsEntry不能转换为java.io.File。 我正在使用以下代码

<int-sftp:inbound-streaming-channel-adapter
    id="sftpAdapter" channel="receiveChannel"
    session-factory="cachingSessionFactory" 
    remote-file-separator="/" remote-directory-expression="'${ftpServerLoc}'" filter="compositeFilter"
    auto-startup="true">
    <int:poller fixed-rate="${pollarInterval}"
        max-messages-per-poll="1" />
</int-sftp:inbound-streaming-channel-adapter>
  <beans:bean id="compositeFilter"
    class="org.springframework.integration.file.filters.CompositeFileListFilter">
    <beans:constructor-arg>
        <beans:list>
             <beans:bean
                class="org.springframework.integration.file.filters.RegexPatternFileListFilter">
                 <beans:constructor-arg value="^.*.(dat|DAT)$" />
            </beans:bean>
            <beans:bean
                class="org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFileListFilter">
                <beans:constructor-arg name="store"
                    ref="metadataStore" />
                <beans:constructor-arg value="" />
            </beans:bean>
        </beans:list>
    </beans:constructor-arg>
</beans:bean>

org.springframework.integration.file.filters.RegexPatternFileListFilter应该是org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilter

您拥有的那个适用于java.io.File;sftp 版本适用于LsEntry(Jsch 对远程文件的表示)。

最新更新