Failed to create route route1

不想你离开。 提交于 2019-12-25 16:46:45

问题


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 -> []]

and here's my router :

<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;
 }

}


回答1:


Move these inside the <aggregate>

<log message=".....${body}...."></log>
<to uri="file:D:/Xmlcopy" />

So the aggregate has children, eg

 <aggregate strategyRef="AggregatorDemo">
   <correlationExpression>
     <constant>true</constant>
   </correlationExpression>
   <log message=".....${body}...."></log>
   <to uri="file:D:/Xmlcopy" />
 </aggregate>


来源:https://stackoverflow.com/questions/47428260/failed-to-create-route-route1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!