- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Apache camel 的新手,正在尝试编写一个路由,该路由应从指定路径上的文件中读取数据并将内容存储在 mongodb 中。好像我在指定 mongodb 路径时做错了什么,结果我在控制台上收到错误 ( Failed to create route route1 at: >>> To[mongodb:myDb?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file:C://workspace//Emai... because of Failed to resolve endpoint: mongodb://myDb?collection=emailResponse&database=email_response&operation=save due to: No component found with scheme: mongodb
),请看一下。
控制台输出
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-03-19 12:02:43.234 ERROR 4616 --- [ main] o.s.boot.SpringApplication
: Application run failedorg.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[mongodb:myDb?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file:C://workspace//Emai... because of Failed to resolve endpoint: mongodb://myDb?collection=emailResponse&database=email_response&operation=save due to: No component found with scheme: mongodb at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:126) ~[camel-spring-boot-2.17.0.jar:2.17.0] at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:41) ~[camel-spring-boot-2.17.0.jar:2.17.0] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:353) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:887) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at com.era.conf.ApplicationConfiguration.main(ApplicationConfiguration.java:12) [classes/:na] Caused by: java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[mongodb:myDb?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file:C://workspace//Emai... because of Failed to resolve endpoint: mongodb://myDb?collection=emailResponse&database=email_response&operation=save due to: No component found with scheme: mongodb at org.apache.camel.spring.boot.CamelSpringBootApplicationController.run(CamelSpringBootApplicationController.java:73) ~[camel-spring-boot-2.17.0.jar:2.17.0] at org.apache.camel.spring.boot.CamelMainRunController$DaemonTask.run(CamelMainRunController.java:43) ~[camel-spring-boot-2.17.0.jar:2.17.0] at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_102] at org.apache.camel.spring.boot.CamelMainRunController.start(CamelMainRunController.java:36) ~[camel-spring-boot-2.17.0.jar:2.17.0] at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:113) ~[camel-spring-boot-2.17.0.jar:2.17.0] ... 16 common frames omitted Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[mongodb:myDb?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file://workspace//Emai... because of Failed to resolve endpoint: mongodb://myDb?collection=emailResponse&database=email_response&operation=save due to: No component found with scheme: mongodb at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3295) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3018) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2848) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2844) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2867) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2844) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2813) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.main.Main.doStart(Main.java:127) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.main.MainSupport.run(MainSupport.java:138) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.spring.boot.CamelSpringBootApplicationController.run(CamelSpringBootApplicationController.java:68) ~[camel-spring-boot-2.17.0.jar:2.17.0] ... 20 common frames omitted Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: mongodb://myDb?collection=emailResponse&database=email_response&operation=save due to: No component found with scheme: mongodb at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:594) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:79) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:211) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219) ~[camel-core-2.17.0.jar:2.17.0] at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069) ~[camel-core-2.17.0.jar:2.17.0] ... 35 common frames omitted
Camel 路线
@Override
public void configure() throws Exception {
from("file:C://workspace//EmailResponseAutomation//response//")
.to("mongodb:myDb?database=email_response&collection=emailResponse&operation=save");
}
依赖关系
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- Apache Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.17.0</version>
</dependency>
</dependencies>
最佳答案
为了将 Camel 与 MongoDB 一起使用,您需要 Camel MongoDB Component , 添加
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mongodb</artifactId>
<version>2.17.0</version>
</dependency>
到你的 pom。
关于java - Camel 路线创建错误,未找到方案 : mongodb 的组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49357107/
我创建了一个 spring-boot 应用程序,我在其中使用 camel-reSTLet 组件将我的 camel 路由公开为 rest 端点。 我的 camel 路由很简单:它们接受来自北向休息端点的
我有一条路由 (route1),它将数据发送到 HTTP 端点。为此,它必须设置授权 header 。 header 值每小时超时一次,必须更新。 为此,我创建了另一个路由 (route2),它使用提
我正在使用 camel-cdi,它正在注入(inject) CamelContext,检测项目中的所有路由。但是我想要一个带有注册表的 CamelContext,因为我有一些在 Camel route
我想使用来自网络服务的数据并将其放入 Camel eh-cache 中。后来我想通过 CacheManager 在 Camel 上下文之外使用这个缓存。我没有找到任何方法。 在下面的代码中,我跳过了
问题描述: 我无法从我的 Camel servlet 路由到 cxfbean。路由初始化失败并显示以下错误消息: "Failed to create route route1 at: >>> To[c
我想了解 Camel 中的工作单元概念。我有一个简单的问题,希望这里有人可以提供帮助。 例如,如果路由 Exchange 涉及多个路由 from("aws-sqs:Q1").to("direct:pr
首先是我正在尝试做的事情的基本轮廓 我有一个 MQ,我想从 读取消息 预处理 XML,并在 Exchange 上设置属性 发出 HTTP 请求 处理来自 http 请求和初始交换中的属性的数据 将其放
我有一个 SFTP 路由(在 Spring XML 中),它的 from 路径以每日更改的目录(即/yyyyMMdd)结尾,并且在 autoCreate=true 时一切正常或者路径开始时目录存在。但
如何用 Camel 实现这样的过程: 拆分 处理每个拆分的项目 聚合结果 如果发生异常: 停止 split 返回异常前所有item的聚合结果及异常信息 split时定义.stopOnException
我在 Camel 中有一条路线,我想在发生异常时重试,但我想设置一个属性,以便路线第二次可以做一些稍微不同的事情,以尝试阻止错误在重试时再次发生。这是说明我目前正在尝试的想法的路线。 from("di
这两个有何不同 from(endpoint).to(endpoint:a, endpoint:b) from(endpoint).multicast().to(endpoint:a, endpoint
我的 Camel 路线如下(示例) from (activemq:xyz) --- 从 QUEUE 接收消息 to(smpp:abc) --- 提交短信至短信中心 to(cxf:hij) --- 基于
我的 Camel 路线如下(示例) from (activemq:xyz) --- 从队列接收消息 to(smpp:abc) --- 将消息提交给 SMSC to(cxf:hij) --- 基于 SM
当捕获异常时,有什么方法可以停止路由执行(显示日志消息后)? java.lang.IllegalA
我正在使用 Camel 进行集成。我有一个用例,其中 Camel 应该将 1 条消息从一个队列传输到另一个队列,但它不断向队列发送相同的消息。请查看我的以下路线: ProducerTemplate正在
当异常在多播内部抛出时,Camel 不会传播异常。 考虑到以下设置,其中 direct:route 从其 beanRef 抛出异常: rest("/...") .pos
有没有办法使用生产者模板设置 Camel 交换属性? 想象一个接收客户订单的休息端点(尚未在 Camel route )。使用生产者模板,我想 在交易所上设置客户 ID 属性。 稍后在路由 需要时使用
再见,我的基本要求是有一个可以发送消息的路由,并将其放在 JMS 队列中。 camel 上下文在 JavaEE 6 容器中运行,即 JBoss AS 7.1.1,因此它是 HornetQ for JM
Camel 2.23.1 Karaf 4.2.4 白羊座蓝图(用于注册所有内容的外部容器) Camel 蓝图(用于 Camel 路线) Camel CXF(用于 rsServer) CXF 核心(用于
现在我在 Java EE 7 应用程序上使用 JMS 2.0 和 Artemis 1.2.0,我想用 Camel 做一些集成任务。 现在查看 camel-jms 文档,没有提及如何使用通用的 came
我是一名优秀的程序员,十分优秀!