java - 如何解决 Apache Camel 中的 "Failed to create route route1 exception"?

标签 java 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

最佳答案

依赖库丢失。所以我添加了这些库并解决了我的问题。

关于java - 如何解决 Apache Camel 中的 "Failed to create route route1 exception"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21802003/

相关文章:

java - 为什么 Android 中不缓存 JSON 异常?

java - 如何通过索引删除行

java - Camel从http获取数据

apache-camel - Camel ActiveMQ 客户端阻塞,临时存储使用率立即达到 100%

java - 使用apache-camel多播将一个文件上传到不同位置

compare - 在 Java 1.5 和 Java 1.7 中重写 'compare()' 时不返回 0 的缺点

java - 如何使用 Java3D API 在 Java 中绘制简单的 3D 点(x,y,z)?

java - 如何复制 java.util.list 集合

java - 如何处理 Camel 中的故障转移负载均衡器故障?

java - 如何处理camel项目中蓝图路由异常