![](/img/trans.png)
[英]Java Error :“ org.apache.camel.FailedToCreateRouteException: Failed to create route route1”
[英]How to solve “Failed to create route route1 exception” in Apache Camel?
我是 Apache Camel 概念的新手。 我曾嘗試使用 apache camel API 編寫示例代碼,但在嘗試運行代碼時出現以下異常。
誰能幫我解決這個問題?
這是示例代碼和一個例外,
示例代碼:
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(Exchange.HTTP_URI,simple("`http://sample-host:8080/demo/get`"))
.to("http://emptyhost");
}
});
context.start();
ProducerTemplate template = context.createProducerTemplate();
System.out.println(template.requestBodyAndHeaders("direct:start", null, null,String.class));
例外 :
Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at:
>>> To[`http://sample-host:8080/demo/get`] <<<
in route: Route(route1)
[[From[direct:start]] -> [`To[http://sample-host:8`…
because of
Failed to resolve endpoint: `http://sample-host:8080/demo/get`
due to:
No component found with scheme: http
缺少依賴庫。 所以我添加了這些庫並解決了我的問題。
我遇到了同樣的錯誤,dis 是由於使用了最新的依賴項。 所以使用舊的依賴項並嘗試。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.