gpt4 book ai didi

java - 使用 Camel 过滤文件名时出现错误

转载 作者:行者123 更新时间:2023-12-02 03:56:31 26 4
gpt4 key购买 nike

我正在尝试使用 apache Camel 对文件名进行过滤。我收到 IllegalArgumentException 类型的错误 - 见下文。你能提供建议吗?

spring 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");
}
}

异常(exception):

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

最佳答案

您必须使用 & 分隔查询参数。在 filtermove 参数之间是一个分号。

关于java - 使用 Camel 过滤文件名时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35395682/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com