【发布时间】:2018-04-27 17:31:12
【问题描述】:
Apache Camel File 组件在 Windows7 中无法正常运行,而在 Linux 中运行没有任何问题。
我的要求:
文件处理后,必须从目录中删除文件。在 Windows 中,由于 .camelLock 文件无法正确删除。
多次尝试后,只有 Apache camel 可以从目录中删除文件。如果尝试无法从目录中删除文件,则会引发异常。
如果我在目录中只有一个文件,它可以正常工作,但如果我有多个文件,那么它会抛出异常。
应用环境:
我在 Tomcat 服务器中部署了 Apache camel 应用程序。
Apache Camel 版本:2.17.1
阿帕奇骆驼路线:
<from uri="file:///var/opt/irs/message?delete=true" />
<to uri="direct:file.storage.original" />
在 Windows 中,我收到以下错误:
1|2017-11-14 17:56:34,828|11-01-41|默认|警告
|是||o.a.c.c.f.GenericFileOnCompletion|file.analysis.input|错误 在提交期间。交换 [ID-51741-1510678404569-9-22]。造成的: [org.apache.camel.component.file.GenericFileOperationFailedException - 无法删除文件:GenericFile[C:\var\opt\irs\message\661.zip]] org.apache.camel.component.file.GenericFileOperationFailedException: 无法删除文件:GenericFile[C:\var\opt\irs\message\661.zip] at org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:89) 在 org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)
类似问题: Camel 2.15 file locks , Camel 2.14.2 not deleting files on Windows,deleting moving files
【问题讨论】:
-
Windows 中有一些其他进程对该文件进行了锁定,因此 Camel(例如 Java JVM)无法删除该文件。因此,请查看您的 Windows 框,什么可能会锁定文件。或者您在该直接路径(我们看不到)中执行某些操作,您忘记关闭某些文件输入或某事,因此文件被锁定。所以仔细检查你的代码。
-
我只在文件组件上遇到这个问题。我尝试在 Windows 中使用 FTP,它工作正常。
-
您在解压缩文件吗?无论如何打开 Zip 都会导致 zip 文件被锁定。
标签: apache-camel soa enterprise-integration