gpt4 book ai didi

apache-camel - Camel : File operation failed: Connection closed without indication. 。代码:421

转载 作者:行者123 更新时间:2023-12-04 02:19:25 27 4
gpt4 key购买 nike

我在部署到 Tomcat 容器中的 Java 8 上使用 Camel 2.15.2 和 Apache Commons Net 3.3。

问题是,在处理完 200 多个文件(目录中超过 4000 个文件)后,路由始终停止,FTP 客户端断开连接,并注销以下消息:

[ogs.sharp-stream.com:21/root/] FtpConsumer                    WARN  Error processing file RemoteFile[route/to/file] due to File operation failed:  Connection closed without indication.. Code: 421. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - File operation failed:  Connection closed without indication.. Code: 421] 
org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: Connection closed without indication.. Code: 421
at org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:713)
at org.apache.camel.component.file.remote.FtpOperations.retrieveFileToFileInLocalWorkDirectory(FtpOperations.java:440)
at org.apache.camel.component.file.remote.FtpOperations.retrieveFile(FtpOperations.java:310)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:384)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:317)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:483)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:608)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:582)
at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1454)
at org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:2658)
at org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:709)
... 15 more

This is the URI在相关路线的开头使用。

从 URI 可以看出,我还使用了 FileIdempotentRepository。是这样定义的

            <property name="fileStore" value="target/fileidempotent/.filestore1.dat" />

<property name="maxFileStoreSize" value="512000" />

<property name="cacheSize" value="250" />
</bean>

知道为什么在所有文件都处理完之前连接可能会关闭吗?

最佳答案

你需要在你的 ftp/ftps url 中添加以下参数

disconnect=true

这将导致在传输文件后断开与远程主机的连接,并在再次触发路由时尝试建立新的连接。(而不是使用陈旧的,它可能已被远程主机/防火墙关闭)

关于apache-camel - Camel : File operation failed: Connection closed without indication. 。代码:421,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31989898/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com