java-骆驼删除文件异常
作者:互联网
当我尝试在Camel中处理文件但失败时,我尝试将文件移至错误目录,但收到以下错误消息:
org.apache.camel.component.file.GenericFileOperationFailedException:无法删除文件:….
我不知道Windows是否正在锁定文件,但是我已经关闭了可能导致此问题发生的所有流.如果是Windows,我该怎么做才能释放此锁?
路由是一个简单的from()… process().. to(),并且在process()之后设置了一些标头,这是to()失败的地方,并且文件也不会移入错误目录预期.
谢谢.
解决方法:
也许与this有关:
Cannot move/delete file after processing on Windows
There is a potential issue on Windows platform with Camel 1.5.x. That
it cannot move or delete the file after processing. You should get an
exception thrown.The workaround is to convert the body to a String after consuming
using convertBodyTo: eg
from(“file://inbox”).convertBodyTo(String.class).to(“file://outbox”);.There should be a fix in Camel 1.6.0 to remedy this, but we would like
to get feedback on this issue. So if you are on Windows please give it
a go.
标签:file,apache-camel,java 来源: https://codeday.me/bug/20191028/1951062.html