未能创建路由 route1 [英] Failed to create route route1
本文介绍了未能创建路由 route1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在解决此异常时遇到了麻烦,而且我不知道自己哪里做错了.这是例外.
i have a trouble solving this exception and i don't know where i'm doing wrong. here's the Exception.
org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> Filter[bean[ref:filter method:accept] -> []] <<< in route: Route(route1)[[From[file:D:/copyy/?noop=true]] -> [Filter[be... because of Definition has no children on Filter[bean[ref:filter method:accept] -> []]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> Aggregate[true -> []] <<< in route: Route(route1)[[From[file:D:/xml/?noop=true]] -> [Aggregate[t... because of Definition has no children on Aggregate[true -> []]
Caused by: java.lang.IllegalArgumentException: Definition has no children on Aggregate[true -> []]
这是我的路由器:
<bean id="AggregatorDemo" class="com.javainuse.AggregatorDemo"/>
<route>
<from uri="file:D:/xml/?noop=true" />
<aggregate strategyRef="AggregatorDemo">
<correlationExpression>
<constant>true</constant>
</correlationExpression>
</aggregate>
<log message=".....${body}...."></log>
<to uri="file:D:/Xmlcopy" />
</route>
这是我正在使用的聚合器类.
and here's the aggregator class i'm using.
public class AggregatorDemo implements AggregationStrategy{
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
String orders = oldExchange.getIn().getBody(String.class);
String newLine = newExchange.getIn().getBody(String.class);
orders = orders+ newLine;
oldExchange.getIn().setBody(orders);
return oldExchange;
}
}
推荐答案
将这些移到
<log message=".....${body}...."></log>
<to uri="file:D:/Xmlcopy" />
所以聚合有孩子,例如
<aggregate strategyRef="AggregatorDemo">
<correlationExpression>
<constant>true</constant>
</correlationExpression>
<log message=".....${body}...."></log>
<to uri="file:D:/Xmlcopy" />
</aggregate>
这篇关于未能创建路由 route1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文