io - 如何修复错误:org.apache.camel.component.file.GenericFileOperationFailedException:无法检索文件?
问题描述
首先我遇到了以下错误: GenericFileOperationFailedException - Cannot change directory to: ..]
我已经通过添加stepwise=false
到端点字符串来修复它:
sftp://sales.data.com:22/data/100?fileName=20190410.dat.gz&password=xxxxxx&stepwise=false&username=UserName
之后它因以下错误而失败,我找不到任何有关解决此问题的相关信息。什么可能导致这里的问题?
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot retrieve file: data/100/20190410.dat.gz
at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:692)
at org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:638)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:411)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:137)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:226)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:190)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
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: java.io.InterruptedIOException
at java.io.PipedInputStream.read(PipedInputStream.java:328)
at java.io.PipedInputStream.read(PipedInputStream.java:377)
at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2325)
at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2351)
at com.jcraft.jsch.ChannelSftp.access$800(ChannelSftp.java:36)
at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:1093)
at com.jcraft.jsch.ChannelSftp$2.read(ChannelSftp.java:1053)
at org.apache.camel.util.IOHelper.copy(IOHelper.java:204)
at org.apache.camel.util.IOHelper.copy(IOHelper.java:169)
at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:218)
at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:214)
at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:687)
解决方案
在你的消费者上使用 readLock,让它等到文件完全被 FTP 编辑。在ftp 的 Camel 文档中,查找此选项:
- 读锁改变
这个想法是:告诉 Camel 在看到文件时不要读取它,而是继续检查它是否在变大。只要它继续增长,骆驼就会等待。您可以更改相关选项以确定等待多长时间等。在该页面中搜索所有提及“readLock”以查找更多信息。
推荐阅读
- angular - ERROR 错误:ViewDestroyedError:尝试使用已破坏的视图:detectChanges inangularjs
- r - 多个滑块和多个按钮。但输出是同一页
- driver - Windows 启动时如何获取 PCI 设备枚举的详细信息
- java - 如何为 JToggleButton 绘制(或不透明)ImageIcon 背景?
- java - 使用 ifPresent 在 JAVA 8 中检查 NULL 安全对象
- php - 显示来自不同表的具有相同 ID 的登录用户的数据
- javascript - 为什么 eth.contract.Transfer 只返回选择的交易?
- android - 无法从 Windows 2016 服务器获得对特定图像文件的任何响应
- wordpress - 排除 Woocommerce 中的类别
- python-3.x - 我需要为提到的页面中的每个职位抓取职位描述文本