春季启动+ mongodb +骆驼路由连接问题 [英] spring boot + mongodb + camel route connection issue

查看:71
本文介绍了春季启动+ mongodb +骆驼路由连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是骆驼路线的新手,试图创建一条路线来读取文件的内容并插入mongodb中,这是有问题的,似乎连接端点不正确.

I am new to camel route, trying to create a route which will read the content of a file and insert in mongodb, there is some wrong with it, seems like connection endpoint is not correct.

路线类别

@Component
public class EmailResponseRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("file:C:/EmailResponseAutomation/response/")
        .to("mongodb://127.0.0.1:27017?database=email_response&collection=emailResponse&operation=save");
    }
}

登录错误

org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException:无法创建路由 route1位于:>>> 要[mongodb://127.0.0.1:27017?database = email_response& collection = emailResponse& operation = save] <<<在路线中:Route(route1)[[来自[文件:C:/workspace/EmailRes ... 由于无法解析端点: mongodb://127.0.0.1:27017?collection = emailResponse& database = email_response& operation =保存 由于:未找到使用方案的组件:mongodb位于 org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:126) 〜[camel-spring-boot-2.17.0.jar:2.17.0]在 org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:41) 〜[camel-spring-boot-2.17.0.jar:2.17.0]在 org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:353) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:887) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) 〜[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) 〜[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]在 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) 〜[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于 org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于 org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于 org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于 com.era.conf.ApplicationConfiguration.main(ApplicationConfiguration.java:12) [classes/:na]原因:java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException:无法创建路由 route1位于:>>> 要[mongodb://127.0.0.1:27017?database = email_response& collection = emailResponse& operation = save] <<<在路线中:Route(route1)[[来自[文件:C:/workspace/EmailRes ... 由于无法解析端点: mongodb://127.0.0.1:27017?collection = emailResponse& database = email_response& operation =保存 由于:未找到使用方案的组件:mongodb位于 org.apache.camel.spring.boot.CamelSpringBootApplicationController.run(CamelSpringBootApplicationController.java:73) 〜[camel-spring-boot-2.17.0.jar:2.17.0]在 org.apache.camel.spring.boot.CamelMainRunController $ DaemonTask.run(CamelMainRunController.java:43) 〜[camel-spring-boot-2.17.0.jar:2.17.0]在 java.lang.Thread.run(Thread.java:745)〜[na:1.8.0_102]在 org.apache.camel.spring.boot.CamelMainRunController.start(CamelMainRunController.java:36) 〜[camel-spring-boot-2.17.0.jar:2.17.0]在 org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:113) 〜[camel-spring-boot-2.17.0.jar:2.17.0] ...省略了16个常见框架 原因:org.apache.camel.FailedToCreateRouteException:失败 在以下位置创建路线route1:>>> 要[mongodb://127.0.0.1:27017?database = email_response& collection = emailResponse& operation = save] <<<在路线中:Route(route1)[[来自[文件:C:/workspace/EmailRes ... 由于无法解析端点: mongodb://127.0.0.1:27017?collection = emailResponse& database = email_response& operation =保存 由于:未找到使用方案的组件:mongodb位于 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3295) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3018) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.access $ 000(DefaultCamelContext.java:175) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext $ 2.call(DefaultCamelContext.java:2848) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext $ 2.call(DefaultCamelContext.java:2844) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2867) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2844) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2813) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.main.Main.doStart(Main.java:127) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.main.MainSupport.run(MainSupport.java:138) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.spring.boot.CamelSpringBootApplicationController.run(CamelSpringBootApplicationController.java:68) 〜[camel-spring-boot-2.17.0.jar:2.17.0] ...省略了20个常见框架 原因:org.apache.camel.ResolveEndpointFailedException:失败 解决端点: mongodb://127.0.0.1:27017?collection = emailResponse& database = email_response& operation =保存 由于:未找到使用方案的组件:mongodb位于 org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:594) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:79) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:211) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219) 〜[camel-core-2.17.0.jar:2.17.0]在 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069) 〜[camel-core-2.17.0.jar:2.17.0] ...省略了35个常见框架

org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.RuntimeException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[mongodb://127.0.0.1:27017?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file:C:/workspace/EmailRes... because of Failed to resolve endpoint: mongodb://127.0.0.1:27017?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://127.0.0.1:27017?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file:C:/workspace/EmailRes... because of Failed to resolve endpoint: mongodb://127.0.0.1:27017?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://127.0.0.1:27017?database=email_response&collection=emailResponse&operation=save] <<< in route: Route(route1)[[From[file:C:/workspace/EmailRes... because of Failed to resolve endpoint: mongodb://127.0.0.1:27017?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://127.0.0.1:27017?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

推荐答案

您需要具有Apache骆驼mongodb依赖性.添加此依赖项

You need to have apache camel mongodb dependency. Add this dependency

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-mongodb</artifactId>
    <version>x.y.z</version>
    <!-- use the same version as your Camel core version -->
</dependency>

从异常中可以看到

未找到使用scheme:mongodb的组件

No component found with scheme: mongodb

这篇关于春季启动+ mongodb +骆驼路由连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆