2016-02-14 46 views
0

我想使用apache駱駝文件名過濾器。 我收到IllegalArgumentException類型的錯誤 - 請參閱下文。 你能指點一下嗎?與駱駝文件名過濾器我得到一個錯誤

春天的xml:

<bean id="adoFilter" class="calypsox.bllInterfaces.cashMgn.cashMgnAdo.AdoFileFilter"/> 
       <camelContext xmlns="http://camel.apache.org/schema/spring" 
           id="cashMgn"> 
           <propertyPlaceholder id="cashMgnProperty" 
               location="${bll.resources.env}/cashMgn.properties" /> 
           <route id="cashMgnAdo"> 
               <from 
                   uri="file:{{cashMgnAdoFileDir}}?filter=#adoFilter;move=.org/${date:now:yyyyMMdd}/${file:name}&amp;readLock=changed&amp;readLockCheckInterval=2000&amp;readLockTimeout=10000&amp;moveFailed=.failed" /> 
               <convertBodyTo type="java.lang.String" /> 
               <to uri="bean:cashMgnHandler?method=handleCashMgnAdo" /> 
           </route> 

       </camelContext> 

java的過濾器類:

 public class AdoFileFilter<T> implements GenericFileFilter<T> { 
       public boolean accept(GenericFile<T> file) { 
           // we want all directories 
           // if (((File) file).isDirectory()) { 
           // return true; 
           // } 

           // we dont accept any files starting with skip in the name 
           return true;// !file.getFileName().startsWith("skip"); 
       } 
} 

例外:

Caused by: java.lang.IllegalArgumentException: 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 #adoFilter;move=.org/${date:now:yyyyMMdd}/${file:name} 

       at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:341) 

       at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:291) 

       at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:225) 

       at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:200) 

       at org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:65) 

       at org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:36) 

       at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75) 

       at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432) 

       ... 28 more 

回答

2

你要查詢參數與&amp;分開。您的filtermove之間的參數是分號代替。

+0

謝謝,就是這樣! – user5157427