No component found with scheme: custom component bean name

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

No component found with scheme: custom component bean name

reji.mathews
This post was updated on .
Hello Camel community

I am manually firing up a camel context with low level API's. The requirement is to create a camel context and add 1 route to it which connects to an activeMQ broker and reads message for processing.

I have following code snippets

Method 1:
ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setUsername(adaptor.configurations.get(USERNAME));
activeMQComponent.setPassword(adaptor.configurations.get(PASSWORD));
activeMQComponent.setBrokerURL(adaptor.configurations.get(BROKERURL_KEY));

newCamelContext.addComponent("amq5d571145df1971486e4cbbdd",activeMQComponent);
... following this, I also have code to add the routes....


For a log printed as follows
logger.info("Component list : {}",newCamelContext.getComponentNames().toString()), during runtime it prints following

"Component list : [servlet, amq5d571145df1971486e4cbbdd]"


Method 2:
I even tried adding the bean to SimpleRegistry and setting the registry to newCamelContext object.

However, the route startup fails with following error
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route 4cf19d40-72fa-4c9a-a284-c6165ccd9999: Route(4cf19d40-72fa-4c9a-a284-c6165ccd9999)[[From[amq5d57114... because of Failed to resolve endpoint: amq5d571145df1971486e4cbbdd://queue:apic-input due to: No component found with scheme: amq5d571145df1971486e4cbbdd
                at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1826) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) ~[camel-spring-2.24.1.jar:2.24.1]
                at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174) ~[camel-spring-2.24.1.jar:2.24.1]
                at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
                at com.reji.camel.Application.main(Application.java:37) [classes/:na]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route 4cf19d40-72fa-4c9a-a284-c6165ccd9999: Route(4cf19d40-72fa-4c9a-a284-c6165ccd9999)[[From[amq5d57114... because of Failed to resolve endpoint: amq5d571145df1971486e4cbbdd://queue:apic-input due to: No component found with scheme: amq5d571145df1971486e4cbbdd
                at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:217) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1140) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3735) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3440) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3248) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3244) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3267) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3244) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3160) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[camel-spring-2.24.1.jar:2.24.1]
                ... 16 common frames omitted
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: amq5d571145df1971486e4cbbdd://queue:apic-input due to: No component found with scheme: amq5d571145df1971486e4cbbdd
                at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:759) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:227) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:122) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:75) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:98) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1332) ~[camel-core-2.24.1.jar:2.24.1]
                at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:212) ~[camel-core-2.24.1.jar:2.24.1]
                ... 26 common frames omitted
Reply | Threaded
Open this post in threaded view
|

Re: No component found with scheme: custom component bean name

Claus Ibsen-2
Hi

From the stacktrace it seems you are using spring, and therefore you
need to register the custom component in spring, not SimpleRegistry.

On Thu, Jan 2, 2020 at 9:56 PM Reji Mathews <[hidden email]> wrote:

>
> Hello Camel community
>
> I am manually firing up a camel context with low level API's. The requirement is to create a camel context and add 1 route to it which connects to an activeMQ broker and reads message for processing.
>
> I have following code snippets
>
> Method 1:
> ActiveMQComponent activeMQComponent = new ActiveMQComponent();
> activeMQComponent.setUsername(adaptor.configurations.get(USERNAME));
> activeMQComponent.setPassword(adaptor.configurations.get(PASSWORD));
> activeMQComponent.setBrokerURL(adaptor.configurations.get(BROKERURL_KEY));
>
> newCamelContext.addComponent("amq5d571145df1971486e4cbbdd",activeMQComponent);
> ... following this, I also have code to add the routes....
>
>
> For a log printed as follows
> logger.info("Component list : {}",newCamelContext.getComponentNames().toString()), during runtime it prints following
>
> "Component list : [servlet, amq5d571145df1971486e4cbbdd]"
>
>
> Method 2:
> I even tried adding the bean to SimpleRegistry and setting the registry to newCamelContext object.
>
> However, the route startup fails with following error
> org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route 4cf19d40-72fa-4c9a-a284-c6165ccd9999: Route(4cf19d40-72fa-4c9a-a284-c6165ccd9999)[[From[amq5d57114... because of Failed to resolve endpoint: amq5d571145df1971486e4cbbdd://queue:apic-input due to: No component found with scheme: amq5d571145df1971486e4cbbdd
>                 at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1826) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) ~[camel-spring-2.24.1.jar:2.24.1]
>                 at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174) ~[camel-spring-2.24.1.jar:2.24.1]
>                 at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
>                 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
>                 at com.huawei.camel.Application.main(Application.java:37) [classes/:na]
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route 4cf19d40-72fa-4c9a-a284-c6165ccd9999: Route(4cf19d40-72fa-4c9a-a284-c6165ccd9999)[[From[amq5d57114... because of Failed to resolve endpoint: amq5d571145df1971486e4cbbdd://queue:apic-input due to: No component found with scheme: amq5d571145df1971486e4cbbdd
>                 at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:217) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1140) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3735) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3440) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3248) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3244) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3267) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3244) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3160) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[camel-spring-2.24.1.jar:2.24.1]
>                 ... 16 common frames omitted
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: amq5d571145df1971486e4cbbdd://queue:apic-input due to: No component found with scheme: amq5d571145df1971486e4cbbdd
>                 at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:759) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:227) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:122) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:75) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:98) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1332) ~[camel-core-2.24.1.jar:2.24.1]
>                 at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:212) ~[camel-core-2.24.1.jar:2.24.1]
>                 ... 26 common frames omitted



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2