Search code examples
javaspring-bootapache-camelfilezilla

I get the exception "Apache Camel Cannot acquire lock within xxx millis. Will skip the file"


I got the execption while uploading a 0-KB .csv file to my FTP server using FileZilla. I am using Apache Camel to route the file and process it.

But while doing so, I am getting a warning "Apache Camel Cannot acquire lock within xxx millis. Will skip the file".

org.apache.camel.component.file.remote.strategy.SftpChangedExclusiveReadLockStrategy Cannot acquire read lock within 20000 millis. Will skip the file: RemoteFile[filename.csv]

Because of this, the file is not getting routed to my application and I am not able to process the file.


Solution

  • An empty file of 0 bytes is regarded as a file that are in-process of being updated. However there is an option on the FTP component where you can set the threshold to 0 bytes as OK to use. See the option readLockMinLength at the FTP docs at: https://camel.apache.org/components/latest/ftp-component.html