Camel filtering issue when using org.apache.camel.component.file.GenericFileFilter

Problem Description

The cFTP component needs to use filter-to-filter on some dates. A bean, created for this purpose, implements the org.apache.camel.component.file.GenericFileFilter. The bean is registered using cBeanRegister with id=myFilter. In the cFTP component, the filter option is set to #myFilter.

 

It runs successfully from Studio but fails when deployed in Runtime, with the following error message:

org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route FILTER_TEST_cFtp_2: 
Route(FILTER_TEST_cFtp_2)[[From[sftp://someuser@someftpserve... because of Failed to resolve endpoint: 
sftp://someuser@someftpserver.com:/somepath?filter=%23myFilter&password=xxxxx due to: Could not find a suitable setter for property: filter as there 
isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: 
java.lang.String to the required type: org.apache.camel.component.file.GenericFileFilter with value #myFilter

 

Root Cause

The camel-core-*.**.*.jar added to the bean libraries, as required, is being included in the route bundle.

 

Solution

  1. Close the bean if it's already open.

  2. Right-click the bean, select Edit Bean Libraries, then remove the camel-core-*.**.*.jar file.

  3. Click New, then enter the camel-core-*.**.*.jar file name in the Input a library's name text box.

  4. Important: clear the If the Library file is required check box.

    bean_lib_not_required.jpg

     

  5. Click OK.

  6. Repeat the steps above for any other bean using a camel-core-*.**.*.jar file.

  7. Rebuild/republish the route before deploying it.

Version history
Revision #:
5 of 5
Last update:
‎08-14-2019 07:09 AM
Updated by: