Error: Multiple RestConsumerFactory found on classpath
Error: Multiple RestConsumerFactory found on classpath
调用 addRouteDefinition
时出错。我正在向 camelcontext 动态添加 rest。
错误
org.apache.camel.FailedToCreateRouteException : Failed to create route ... because of Multiple RestConsumerFactory found on classpath. Configure explicit which component to use
RestsDefinition rests = camelContext.loadRestsDefinition(is);
camelContext.addRestDefinitions(rests.getRests());
for (RestDefinition restDefinition : rests.getRests()) {
List<RouteDefinition> routeDefinitions = restDefinition.asRouteDefinition(camelContext);
System.out.println(routeDefinitions);
//camelContext.addRouteDefinitions(routeDefinitions);
for (RouteDefinition route1 : routeDefinitions) {
System.out.println("Route being Added : " + route1.getId());
//Getting Error in this line
camelContext.addRouteDefinition(route1);
}
}
谁能帮我解决这个问题。
谢谢。
问题出在 RestConfiguration
上,因为 RestConfiguration 没有在添加的 camelcontext 上正确设置。 camelContext.addRestConfiguration(restConfiguration);
调用 addRouteDefinition
时出错。我正在向 camelcontext 动态添加 rest。
错误
org.apache.camel.FailedToCreateRouteException : Failed to create route ... because of Multiple RestConsumerFactory found on classpath. Configure explicit which component to use
RestsDefinition rests = camelContext.loadRestsDefinition(is);
camelContext.addRestDefinitions(rests.getRests());
for (RestDefinition restDefinition : rests.getRests()) {
List<RouteDefinition> routeDefinitions = restDefinition.asRouteDefinition(camelContext);
System.out.println(routeDefinitions);
//camelContext.addRouteDefinitions(routeDefinitions);
for (RouteDefinition route1 : routeDefinitions) {
System.out.println("Route being Added : " + route1.getId());
//Getting Error in this line
camelContext.addRouteDefinition(route1);
}
}
谁能帮我解决这个问题。 谢谢。
问题出在 RestConfiguration
上,因为 RestConfiguration 没有在添加的 camelcontext 上正确设置。 camelContext.addRestConfiguration(restConfiguration);