How to solve quot;Failed to create route route1 exceptionquot; in Apache Camel?(如何解决“无法创建路由 route1 异常在阿帕奇骆驼?)
问题描述
我是 Apache Camel 概念的新手.我尝试使用 apache camel API 编写示例代码尝试运行代码时出现以下异常.
I am new for Apache Camel concept. I have tried to write sample code using with apache camel API's and I am getting the following exception when try to run the code.
谁能帮我解决这个问题?
这里是示例代码和一个异常,
Here's the sample code and an exception as well,
示例代码:
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
推荐答案
缺少依赖库.所以我添加了这些库并解决了我的问题.
Dependency libraries were missing. So i have added those libraries and solved my issue.
这篇关于如何解决“无法创建路由 route1 异常"在阿帕奇骆驼?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何解决“无法创建路由 route1 异常"在阿帕奇骆驼?
基础教程推荐
- 如何使用 Java 创建 X509 证书? 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 降序排序:Java Map 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01