camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bryan <brya...@gmail.com>
Subject File can't be moved or deleted on Windows
Date Fri, 02 Jul 2010 00:33:50 GMT

I'm using Camel 2.3.0 on Windows 7 Pro 64-bit with JDK 1.6.0_20 64-bit. I
have come across an issue with the file component where the file being read
cannot be moved or deleted after processing, when using a split. I can
reproduce this every time. Here is a simple version of my route setup using
a Spring context which will cause the problem:

<camel:camelContext id="camelContext">
  <camel:template id="camelTemplate" />
  <camel:route>
    <camel:from uri="file:data" />
    <camel:split>
      <camel:tokenize token="\n" />
      <camel:to uri="mock:out" />
    </camel:split>
  </camel:route>
</camel:camelContext>

My import file is a small, 2 line file. Using this route will result in an
error when processing is complete, and Camel gets in a loop where it keeps
reloading the file (as the file wasn't moved from the poll directory).

2010-07-01 17:29:48,691 FINE [file.GenericFileOnCompletion] Done processing
file: GenericFile[test.csv] using exchange: Exchange[GenericFileMessage with
file: GenericFile[test.csv]]
2010-07-01 17:29:48,692 FINE [util.FileUtil] Tried 1 to delete file:
C:\src\data\test.csv.camelLock with result: true
2010-07-01 17:29:48,693 FINE [strategy.GenericFileRenameProcessStrategy]
Renaming file: GenericFile[test.csv] to: GenericFile[.camel\test.csv]
2010-07-01 17:29:48,693 FINE [util.FileUtil] Retrying attempt 1 to rename
file from: C:\src\data\test.csv to: data\.camel\test.csv
2010-07-01 17:29:49,693 FINE [util.FileUtil] Retrying attempt 2 to rename
file from: C:\src\data\test.csv to: data\.camel\test.csv
2010-07-01 17:29:50,693 FINE [util.FileUtil] Tried 3 to rename file:
C:\src\data\test.csv to: data\.camel\test.csv with result: false
2010-07-01 17:29:50,696 SEVERE [file.GenericFileOnCompletion] Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Cannot rename file: GenericFile[test.csv] to: GenericFile[.camel\test.csv]]:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
rename file: GenericFile[test.csv] to: GenericFile[.camel\test.csv]

Interestingly, if I do not use a split, the file is moved without an issue:

<camel:camelContext id="camelContext">
  <camel:template id="camelTemplate" />
  <camel:route>
    <camel:from uri="file:data" />
    <camel:to uri="mock:out" />
  </camel:route>
</camel:camelContext>

Also, on Linux, this problem does not occur at all, with or without the
split.

-- 
View this message in context: http://camel.465427.n5.nabble.com/File-can-t-be-moved-or-deleted-on-Windows-tp512484p512484.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message