You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by hr...@rba.hr on 2018/03/20 17:59:21 UTC

Please correct ids to be unique among all your routes.

Hi,

if I try to build this code:

package org.mycompany;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;


public class MyFirstRouterBuilder extends RouteBuilder {
     @Override
    public void configure() throws Exception {
        try{
        restConfiguration().component("servlet");
            rest()
            .get("/accounts/{accountId}/transactions").id("r1")
                .param()
                    .name("accountId")
                    .type(RestParamType.path)
                    .dataType("string")
                    .required(true)
                .endParam()
                .to("direct:rest1");
 
                from("direct:rest1")
                 .log("${body}");
 
        }catch(Exception e){

        }
     }
}

I receive: 

org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToStartRouteException: Failed to start route r1 
because of duplicate id detected: r1. Please correct ids to be unique 
among all your routes.

If I add .routeId("r2") or .id("r2") to the second route, immediately 
after from("direct:rest1"), nothing changes.

If I remove .id("r1") from the rest get operation, I receive:

org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToStartRouteException: Failed to start route route1 
because of duplicate id detected: route2. Please correct ids to be unique 
among all your routes.

How is this supposed to be written in order to avoid that error?
I inject that into camel context like this:

    <bean class="org.mycompany.MyFirstRouterBuilder" id="myFirstRouter"/>
    <camelContext id="camel" useBreadcrumb="false" xmlns="
http://camel.apache.org/schema/spring">
        <routeBuilder ref="myFirstRouter"/>
    </camelContext>
______________________

Napomena:
Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih problema prilikom dostave ove poruke.

Disclaimer:
This e-mail message and any attachment may contain confidental and/or privileged information and is intended for use by the indicated addressee only. If you have received this message in error, please notify the sender immediately, destroy the original message and any attachment and delete this message and any attachment from your system. Unauthorized use, distribution, disclosure, reproduction, or alteration of this e-mail message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts legally binding statements via e-mail unless otherwise stated. Considering that internet communication is not secured, Raiffeisenbank Austria d.d. is not responsible for the content of this message, for potential damage occured due to infection of this message with a virus or other malicious program, and for potential technical problems during delivery of this message.

AW: Please correct ids to be unique among all your routes.

Posted by "Walzer, Thomas" <th...@integratix.net>.
Hi,

I would try to remove the id/routeId from every route/rest. Then start your thing and look via jconsole how many instances of your Routebuilder are actually running. 

Cheers, Thomas.

-----Ursprüngliche Nachricht-----
Von: hrvoje.djurdjevic@rba.hr <hr...@rba.hr> 
Gesendet: Dienstag, 20. März 2018 18:59
An: users@camel.apache.org
Betreff: Please correct ids to be unique among all your routes.

Hi,

if I try to build this code:

package org.mycompany;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestParamType;


public class MyFirstRouterBuilder extends RouteBuilder {
     @Override
    public void configure() throws Exception {
        try{
        restConfiguration().component("servlet");
            rest()
            .get("/accounts/{accountId}/transactions").id("r1")
                .param()
                    .name("accountId")
                    .type(RestParamType.path)
                    .dataType("string")
                    .required(true)
                .endParam()
                .to("direct:rest1");
 
                from("direct:rest1")
                 .log("${body}");
 
        }catch(Exception e){

        }
     }
}

I receive: 

org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToStartRouteException: Failed to start route r1 because of duplicate id detected: r1. Please correct ids to be unique among all your routes.

If I add .routeId("r2") or .id("r2") to the second route, immediately after from("direct:rest1"), nothing changes.

If I remove .id("r1") from the rest get operation, I receive:

org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToStartRouteException: Failed to start route route1 because of duplicate id detected: route2. Please correct ids to be unique among all your routes.

How is this supposed to be written in order to avoid that error?
I inject that into camel context like this:

    <bean class="org.mycompany.MyFirstRouterBuilder" id="myFirstRouter"/>
    <camelContext id="camel" useBreadcrumb="false" xmlns="
http://camel.apache.org/schema/spring">
        <routeBuilder ref="myFirstRouter"/>
    </camelContext>
______________________

Napomena:
Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih problema prilikom dostave ove poruke.

Disclaimer:
This e-mail message and any attachment may contain confidental and/or privileged information and is intended for use by the indicated addressee only. If you have received this message in error, please notify the sender immediately, destroy the original message and any attachment and delete this message and any attachment from your system. Unauthorized use, distribution, disclosure, reproduction, or alteration of this e-mail message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts legally binding statements via e-mail unless otherwise stated. Considering that internet communication is not secured, Raiffeisenbank Austria d.d. is not responsible for the content of this message, for potential damage occured due to infection of this message with a virus or other malicious program, and for potential technical problems during delivery of this message.

Fwd: Please correct ids to be unique among all your routes.

Posted by Hrvoje Djurdjevic <hr...@gmail.com>.
I managed to find out why rest routes seemed to stop working, although I
saw they are correctly started in java console.
I was receiving:

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this
as a fallback.
There was an unexpected error (type=Not Found, status=404). No message
available

The reason is described here:
https://stackoverflow.com/questions/41099262/camel-cant-access-rest-service
So, basically, after excluding Camel auto configuration, I had to
register Camel HTTP Servlet by adding this code to the main spring
application class:

    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        ServletRegistrationBean registration = new
ServletRegistrationBean(new CamelHttpTransportServlet(), "/*");
        registration.setName("CamelServlet");
        return registration;
    }

After that, everything works OK.

---------- Forwarded message ----------
From: Hrvoje Djurdjevic <hr...@gmail.com>
Date: Fri, Mar 23, 2018 at 6:18 PM
Subject: Re: Please correct ids to be unique among all your routes.
To: users@camel.apache.org


OK, I managed to solve the problem by excluding Camel Auto configuration,
adding this annotation:

@EnableAutoConfiguration(exclude = {CamelAutoConfiguration.class})

Plus, I added this line to application.properties:

camel.springboot.name=MyCamel

, and changed id of camelContext in camel-context.xml to the same value
like this:

    <camelContext id="MyCamel" useBreadcrumb="false" xmlns="
http://camel.apache.org/schema/spring">

Then all routes, rest and direct:  started OK. But I still have to figure
out why they don't seem to work now. Maybe I broke something in the process.


On Fri, Mar 23, 2018 at 4:18 PM, Hrvoje Djurdjevic <
hrvoje.djurdjevic@gmail.com> wrote:

> Hi,
>
> I'm using Apache Camel 2.20.1 and spring-boot-1.5.9.RELEASE, besides that
> I see spring-context-4.3.13.RELEASE.jar and spring-beans-4.3.13.RELEASE.jar
> printed in the error stack trace.
> I don't get it, is it possible that I may be adding routes two times, once
> through an explicit Camel Context and second time through an implicit
> default Camel Context?
> I import the configuration for the first by adding this import resource
> annotation:
>
>
> @SpringBootApplication
> //load regular Spring XML file from the classpath that contains the Camel
> XML DSL
> @ImportResource({"classpath:spring/camel-context.xml"})
>
> What files exactly do you want me to send you, that are critical to
> understand my problem? I'd rather avoid sending the whole project.
>
> Error starting ApplicationContext. To display the auto-configuration
> report re-run your application with 'debug' enabled.
> 2018-03-23 15:50:33.398  INFO 10492 --- [           main]
> ationConfigEmbeddedWebApplicationContext : Closing
> org.springframework.boot.context.embedded.AnnotationConfigEm
> beddedWebApplicationContext@70f5f57d: startup date [Fri Mar 23 15:50:32
> CET 2018]; parent: org.springframework.boot.conte
> xt.embedded.AnnotationConfigEmbeddedWebApplicationContext@29ba4338
> 2018-03-23 15:50:33.414 ERROR 10492 --- [           main]
> o.s.boot.SpringApplication               : Application startup failed
>
> org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToStartRouteException:
> Failed to start route rest_getAccounts because of duplicate id detected:
> rest_getAccounts. Please correct ids to be unique among all your routes.
> at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1831)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
> ~[camel-spring-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:369)
> ~[camel-spring-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.CamelContextFactoryBean.onApplicatio
> nEvent(CamelContextFactoryBean.java:416) ~[camel-spring-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.CamelContextFactoryBean.onApplicatio
> nEvent(CamelContextFactoryBean.java:94) ~[camel-spring-2.20.1.jar:2.20.1]
> at org.springframework.context.event.SimpleApplicationEventMult
> icaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.event.SimpleApplicationEventMult
> icaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.event.SimpleApplicationEventMult
> icaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.publishEvent(AbstractApplicationContext.java:393)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.publishEvent(AbstractApplicationContext.java:399)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.publishEvent(AbstractApplicationContext.java:347)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.finishRefresh(AbstractApplicationContext.java:883)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.boot.context.embedded.EmbeddedWebApplica
> tionContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
> ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.refresh(AbstractApplicationContext.java:546)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.boot.context.embedded.EmbeddedWebApplica
> tionContext.refresh(EmbeddedWebApplicationContext.java:122)
> ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.actuate.autoconfigure.EndpointWebMv
> cAutoConfiguration.createChildManagementContext(EndpointWebMvcAutoConfiguration.java:193)
> ~[spring-boot-actuator-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.actuate.autoconfigure.EndpointWebMv
> cAutoConfiguration.afterSingletonsInstantiated(En
> dpointWebMvcAutoConfiguration.java:156) ~[spring-boot-actuator-1.5.9.R
> ELEASE.jar:1.5.9.RELEASE]
> at org.springframework.beans.factory.support.DefaultListableBea
> nFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:781)
> ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationConte
> xt.refresh(AbstractApplicationContext.java:543)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.boot.context.embedded.EmbeddedWebApplica
> tionContext.refresh(EmbeddedWebApplicationContext.java:122)
> ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at hr.rba.digital.poc.accounts.AccountsApplication.main(AccountsApplication.java:14)
> [classes/:na]
> Caused by: org.apache.camel.FailedToStartRouteException: Failed to start
> route rest_getAccounts because of duplicate id detected: rest_getAccounts.
> Please correct ids to be unique among all your routes.
> at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1137)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.startRouteDefiniti
> ons(DefaultCamelContext.java:3727) ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3441)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3245)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClass
> Loader(DefaultCamelContext.java:3268) ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3245)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3168)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
> ~[camel-spring-2.20.1.jar:2.20.1]
> ... 25 common frames omitted
>
> 2018-03-23 15:50:33.414  INFO 10492 --- [           main]
> ationConfigEmbeddedWebApplicationContext : Closing
> org.springframework.boot.context.embedded.AnnotationConfigEm
> beddedWebApplicationContext@29ba4338: startup date [Fri Mar 23 15:50:23
> CET 2018]; root of context hierarchy
> 2018-03-23 15:50:33.414  INFO 10492 --- [           main]
> o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed
> beans on shutdown
>
> Best Regards
>
> On Thu, Mar 22, 2018 at 3:07 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
>
>> Hi
>>
>> What version of Camel and Spring Boot do you use?
>> And can you maybe put your sample project on github or something so we
>> can take a look there and try it out
>>
>> On Tue, Mar 20, 2018 at 6:59 PM,  <hr...@rba.hr> wrote:
>> > Hi,
>> >
>> > if I try to build this code:
>> >
>> > package org.mycompany;
>> >
>> > import org.apache.camel.builder.RouteBuilder;
>> > import org.apache.camel.model.rest.RestParamType;
>> >
>> >
>> > public class MyFirstRouterBuilder extends RouteBuilder {
>> >      @Override
>> >     public void configure() throws Exception {
>> >         try{
>> >         restConfiguration().component("servlet");
>> >             rest()
>> >             .get("/accounts/{accountId}/transactions").id("r1")
>> >                 .param()
>> >                     .name("accountId")
>> >                     .type(RestParamType.path)
>> >                     .dataType("string")
>> >                     .required(true)
>> >                 .endParam()
>> >                 .to("direct:rest1");
>> >
>> >                 from("direct:rest1")
>> >                  .log("${body}");
>> >
>> >         }catch(Exception e){
>> >
>> >         }
>> >      }
>> > }
>> >
>> > I receive:
>> >
>> > org.apache.camel.spring.boot.CamelSpringBootInitializationException:
>> > org.apache.camel.FailedToStartRouteException: Failed to start route r1
>> > because of duplicate id detected: r1. Please correct ids to be unique
>> > among all your routes.
>> >
>> > If I add .routeId("r2") or .id("r2") to the second route, immediately
>> > after from("direct:rest1"), nothing changes.
>> >
>> > If I remove .id("r1") from the rest get operation, I receive:
>> >
>> > org.apache.camel.spring.boot.CamelSpringBootInitializationException:
>> > org.apache.camel.FailedToStartRouteException: Failed to start route
>> route1
>> > because of duplicate id detected: route2. Please correct ids to be
>> unique
>> > among all your routes.
>> >
>> > How is this supposed to be written in order to avoid that error?
>> > I inject that into camel context like this:
>> >
>> >     <bean class="org.mycompany.MyFirstRouterBuilder"
>> id="myFirstRouter"/>
>> >     <camelContext id="camel" useBreadcrumb="false" xmlns="
>> > http://camel.apache.org/schema/spring">
>> >         <routeBuilder ref="myFirstRouter"/>
>> >     </camelContext>
>> > ______________________
>> >
>> > Napomena:
>> > Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive
>> i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu
>> naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o
>> tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i
>> njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg
>> sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili
>> izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti
>> ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim
>> ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom
>> nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za
>> sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove
>> poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih
>> problema prilikom dostave ove poruke.
>> >
>> > Disclaimer:
>> > This e-mail message and any attachment may contain confidental and/or
>> privileged information and is intended for use by the indicated addressee
>> only. If you have received this message in error, please notify the sender
>> immediately, destroy the original message and any attachment and delete
>> this message and any attachment from your system. Unauthorized use,
>> distribution, disclosure, reproduction, or alteration of this e-mail
>> message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts
>> legally binding statements via e-mail unless otherwise stated. Considering
>> that internet communication is not secured, Raiffeisenbank Austria d.d. is
>> not responsible for the content of this message, for potential damage
>> occured due to infection of this message with a virus or other malicious
>> program, and for potential technical problems during delivery of this
>> message.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>

Re: Please correct ids to be unique among all your routes.

Posted by Hrvoje Djurdjevic <hr...@gmail.com>.
OK, I managed to solve the problem by excluding Camel Auto configuration,
adding this annotation:

@EnableAutoConfiguration(exclude = {CamelAutoConfiguration.class})

Plus, I added this line to application.properties:

camel.springboot.name=MyCamel

, and changed id of camelContext in camel-context.xml to the same value
like this:

    <camelContext id="MyCamel" useBreadcrumb="false" xmlns="
http://camel.apache.org/schema/spring">

Then all routes, rest and direct:  started OK. But I still have to figure
out why they don't seem to work now. Maybe I broke something in the process.


On Fri, Mar 23, 2018 at 4:18 PM, Hrvoje Djurdjevic <
hrvoje.djurdjevic@gmail.com> wrote:

> Hi,
>
> I'm using Apache Camel 2.20.1 and spring-boot-1.5.9.RELEASE, besides that
> I see spring-context-4.3.13.RELEASE.jar and spring-beans-4.3.13.RELEASE.jar
> printed in the error stack trace.
> I don't get it, is it possible that I may be adding routes two times, once
> through an explicit Camel Context and second time through an implicit
> default Camel Context?
> I import the configuration for the first by adding this import resource
> annotation:
>
>
> @SpringBootApplication
> //load regular Spring XML file from the classpath that contains the Camel
> XML DSL
> @ImportResource({"classpath:spring/camel-context.xml"})
>
> What files exactly do you want me to send you, that are critical to
> understand my problem? I'd rather avoid sending the whole project.
>
> Error starting ApplicationContext. To display the auto-configuration
> report re-run your application with 'debug' enabled.
> 2018-03-23 15:50:33.398  INFO 10492 --- [           main]
> ationConfigEmbeddedWebApplicationContext : Closing
> org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApp
> licationContext@70f5f57d: startup date [Fri Mar 23 15:50:32 CET 2018];
> parent: org.springframework.boot.context.embedded.
> AnnotationConfigEmbeddedWebApplicationContext@29ba4338
> 2018-03-23 15:50:33.414 ERROR 10492 --- [           main]
> o.s.boot.SpringApplication               : Application startup failed
>
> org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToStartRouteException:
> Failed to start route rest_getAccounts because of duplicate id detected:
> rest_getAccounts. Please correct ids to be unique among all your routes.
> at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1831)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
> ~[camel-spring-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.CamelContextFactoryBean.start(
> CamelContextFactoryBean.java:369) ~[camel-spring-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(
> CamelContextFactoryBean.java:416) ~[camel-spring-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(
> CamelContextFactoryBean.java:94) ~[camel-spring-2.20.1.jar:2.20.1]
> at org.springframework.context.event.SimpleApplicationEventMulticas
> ter.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.event.SimpleApplicationEventMulticas
> ter.invokeListener(SimpleApplicationEventMulticaster.java:165)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.event.SimpleApplicationEventMulticas
> ter.multicastEvent(SimpleApplicationEventMulticaster.java:139)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.
> publishEvent(AbstractApplicationContext.java:393) ~[spring-context-4.3.13.
> RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.
> publishEvent(AbstractApplicationContext.java:399) ~[spring-context-4.3.13.
> RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.
> publishEvent(AbstractApplicationContext.java:347) ~[spring-context-4.3.13.
> RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.
> finishRefresh(AbstractApplicationContext.java:883)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.boot.context.embedded.
> EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
> ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.refresh(
> AbstractApplicationContext.java:546) ~[spring-context-4.3.13.
> RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.boot.context.embedded.
> EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
> ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.actuate.autoconfigure.
> EndpointWebMvcAutoConfiguration.createChildManagementContext(
> EndpointWebMvcAutoConfiguration.java:193) ~[spring-boot-actuator-1.5.9.
> RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.actuate.autoconfigure.
> EndpointWebMvcAutoConfiguration.afterSingletonsInstantiated(
> EndpointWebMvcAutoConfiguration.java:156) ~[spring-boot-actuator-1.5.9.
> RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.beans.factory.support.DefaultListableBeanFactory.
> preInstantiateSingletons(DefaultListableBeanFactory.java:781)
> ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.
> finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
> ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.context.support.AbstractApplicationContext.refresh(
> AbstractApplicationContext.java:543) ~[spring-context-4.3.13.
> RELEASE.jar:4.3.13.RELEASE]
> at org.springframework.boot.context.embedded.
> EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
> ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
> [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
> at hr.rba.digital.poc.accounts.AccountsApplication.main(AccountsApplication.java:14)
> [classes/:na]
> Caused by: org.apache.camel.FailedToStartRouteException: Failed to start
> route rest_getAccounts because of duplicate id detected: rest_getAccounts.
> Please correct ids to be unique among all your routes.
> at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1137)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3727)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3441)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.access$
> 000(DefaultCamelContext.java:208) ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3245)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3268)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3245)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3168)
> ~[camel-core-2.20.1.jar:2.20.1]
> at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
> ~[camel-spring-2.20.1.jar:2.20.1]
> ... 25 common frames omitted
>
> 2018-03-23 15:50:33.414  INFO 10492 --- [           main]
> ationConfigEmbeddedWebApplicationContext : Closing
> org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApp
> licationContext@29ba4338: startup date [Fri Mar 23 15:50:23 CET 2018];
> root of context hierarchy
> 2018-03-23 15:50:33.414  INFO 10492 --- [           main] o.s.j.e.a.AnnotationMBeanExporter
>       : Unregistering JMX-exposed beans on shutdown
>
> Best Regards
>
> On Thu, Mar 22, 2018 at 3:07 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
>
>> Hi
>>
>> What version of Camel and Spring Boot do you use?
>> And can you maybe put your sample project on github or something so we
>> can take a look there and try it out
>>
>> On Tue, Mar 20, 2018 at 6:59 PM,  <hr...@rba.hr> wrote:
>> > Hi,
>> >
>> > if I try to build this code:
>> >
>> > package org.mycompany;
>> >
>> > import org.apache.camel.builder.RouteBuilder;
>> > import org.apache.camel.model.rest.RestParamType;
>> >
>> >
>> > public class MyFirstRouterBuilder extends RouteBuilder {
>> >      @Override
>> >     public void configure() throws Exception {
>> >         try{
>> >         restConfiguration().component("servlet");
>> >             rest()
>> >             .get("/accounts/{accountId}/transactions").id("r1")
>> >                 .param()
>> >                     .name("accountId")
>> >                     .type(RestParamType.path)
>> >                     .dataType("string")
>> >                     .required(true)
>> >                 .endParam()
>> >                 .to("direct:rest1");
>> >
>> >                 from("direct:rest1")
>> >                  .log("${body}");
>> >
>> >         }catch(Exception e){
>> >
>> >         }
>> >      }
>> > }
>> >
>> > I receive:
>> >
>> > org.apache.camel.spring.boot.CamelSpringBootInitializationException:
>> > org.apache.camel.FailedToStartRouteException: Failed to start route r1
>> > because of duplicate id detected: r1. Please correct ids to be unique
>> > among all your routes.
>> >
>> > If I add .routeId("r2") or .id("r2") to the second route, immediately
>> > after from("direct:rest1"), nothing changes.
>> >
>> > If I remove .id("r1") from the rest get operation, I receive:
>> >
>> > org.apache.camel.spring.boot.CamelSpringBootInitializationException:
>> > org.apache.camel.FailedToStartRouteException: Failed to start route
>> route1
>> > because of duplicate id detected: route2. Please correct ids to be
>> unique
>> > among all your routes.
>> >
>> > How is this supposed to be written in order to avoid that error?
>> > I inject that into camel context like this:
>> >
>> >     <bean class="org.mycompany.MyFirstRouterBuilder"
>> id="myFirstRouter"/>
>> >     <camelContext id="camel" useBreadcrumb="false" xmlns="
>> > http://camel.apache.org/schema/spring">
>> >         <routeBuilder ref="myFirstRouter"/>
>> >     </camelContext>
>> > ______________________
>> >
>> > Napomena:
>> > Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive
>> i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu
>> naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o
>> tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i
>> njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg
>> sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili
>> izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti
>> ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim
>> ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom
>> nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za
>> sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove
>> poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih
>> problema prilikom dostave ove poruke.
>> >
>> > Disclaimer:
>> > This e-mail message and any attachment may contain confidental and/or
>> privileged information and is intended for use by the indicated addressee
>> only. If you have received this message in error, please notify the sender
>> immediately, destroy the original message and any attachment and delete
>> this message and any attachment from your system. Unauthorized use,
>> distribution, disclosure, reproduction, or alteration of this e-mail
>> message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts
>> legally binding statements via e-mail unless otherwise stated. Considering
>> that internet communication is not secured, Raiffeisenbank Austria d.d. is
>> not responsible for the content of this message, for potential damage
>> occured due to infection of this message with a virus or other malicious
>> program, and for potential technical problems during delivery of this
>> message.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>

Re: Please correct ids to be unique among all your routes.

Posted by Hrvoje Djurdjevic <hr...@gmail.com>.
Hi,

I'm using Apache Camel 2.20.1 and spring-boot-1.5.9.RELEASE, besides that I
see spring-context-4.3.13.RELEASE.jar and spring-beans-4.3.13.RELEASE.jar
printed in the error stack trace.
I don't get it, is it possible that I may be adding routes two times, once
through an explicit Camel Context and second time through an implicit
default Camel Context?
I import the configuration for the first by adding this import resource
annotation:


@SpringBootApplication
//load regular Spring XML file from the classpath that contains the Camel
XML DSL
@ImportResource({"classpath:spring/camel-context.xml"})

What files exactly do you want me to send you, that are critical to
understand my problem? I'd rather avoid sending the whole project.

Error starting ApplicationContext. To display the auto-configuration report
re-run your application with 'debug' enabled.
2018-03-23 15:50:33.398  INFO 10492 --- [           main]
ationConfigEmbeddedWebApplicationContext : Closing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@70f5f57d:
startup date [Fri Mar 23 15:50:32 CET 2018]; parent:
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29ba4338
2018-03-23 15:50:33.414 ERROR 10492 --- [           main]
o.s.boot.SpringApplication               : Application startup failed

org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToStartRouteException: Failed to start route
rest_getAccounts because of duplicate id detected: rest_getAccounts. Please
correct ids to be unique among all your routes.
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1831)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
~[camel-spring-2.20.1.jar:2.20.1]
at
org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:369)
~[camel-spring-2.20.1.jar:2.20.1]
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:416)
~[camel-spring-2.20.1.jar:2.20.1]
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94)
~[camel-spring-2.20.1.jar:2.20.1]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.createChildManagementContext(EndpointWebMvcAutoConfiguration.java:193)
~[spring-boot-actuator-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.afterSingletonsInstantiated(EndpointWebMvcAutoConfiguration.java:156)
~[spring-boot-actuator-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:781)
~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
at
hr.rba.digital.poc.accounts.AccountsApplication.main(AccountsApplication.java:14)
[classes/:na]
Caused by: org.apache.camel.FailedToStartRouteException: Failed to start
route rest_getAccounts because of duplicate id detected: rest_getAccounts.
Please correct ids to be unique among all your routes.
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1137)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3727)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3441)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3245)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3268)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3245)
~[camel-core-2.20.1.jar:2.20.1]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3168)
~[camel-core-2.20.1.jar:2.20.1]
at
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
~[camel-spring-2.20.1.jar:2.20.1]
... 25 common frames omitted

2018-03-23 15:50:33.414  INFO 10492 --- [           main]
ationConfigEmbeddedWebApplicationContext : Closing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29ba4338:
startup date [Fri Mar 23 15:50:23 CET 2018]; root of context hierarchy
2018-03-23 15:50:33.414  INFO 10492 --- [           main]
o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans
on shutdown

Best Regards

On Thu, Mar 22, 2018 at 3:07 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> What version of Camel and Spring Boot do you use?
> And can you maybe put your sample project on github or something so we
> can take a look there and try it out
>
> On Tue, Mar 20, 2018 at 6:59 PM,  <hr...@rba.hr> wrote:
> > Hi,
> >
> > if I try to build this code:
> >
> > package org.mycompany;
> >
> > import org.apache.camel.builder.RouteBuilder;
> > import org.apache.camel.model.rest.RestParamType;
> >
> >
> > public class MyFirstRouterBuilder extends RouteBuilder {
> >      @Override
> >     public void configure() throws Exception {
> >         try{
> >         restConfiguration().component("servlet");
> >             rest()
> >             .get("/accounts/{accountId}/transactions").id("r1")
> >                 .param()
> >                     .name("accountId")
> >                     .type(RestParamType.path)
> >                     .dataType("string")
> >                     .required(true)
> >                 .endParam()
> >                 .to("direct:rest1");
> >
> >                 from("direct:rest1")
> >                  .log("${body}");
> >
> >         }catch(Exception e){
> >
> >         }
> >      }
> > }
> >
> > I receive:
> >
> > org.apache.camel.spring.boot.CamelSpringBootInitializationException:
> > org.apache.camel.FailedToStartRouteException: Failed to start route r1
> > because of duplicate id detected: r1. Please correct ids to be unique
> > among all your routes.
> >
> > If I add .routeId("r2") or .id("r2") to the second route, immediately
> > after from("direct:rest1"), nothing changes.
> >
> > If I remove .id("r1") from the rest get operation, I receive:
> >
> > org.apache.camel.spring.boot.CamelSpringBootInitializationException:
> > org.apache.camel.FailedToStartRouteException: Failed to start route
> route1
> > because of duplicate id detected: route2. Please correct ids to be unique
> > among all your routes.
> >
> > How is this supposed to be written in order to avoid that error?
> > I inject that into camel context like this:
> >
> >     <bean class="org.mycompany.MyFirstRouterBuilder"
> id="myFirstRouter"/>
> >     <camelContext id="camel" useBreadcrumb="false" xmlns="
> > http://camel.apache.org/schema/spring">
> >         <routeBuilder ref="myFirstRouter"/>
> >     </camelContext>
> > ______________________
> >
> > Napomena:
> > Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive
> i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu
> naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o
> tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i
> njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg
> sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili
> izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti
> ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim
> ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom
> nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za
> sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove
> poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih
> problema prilikom dostave ove poruke.
> >
> > Disclaimer:
> > This e-mail message and any attachment may contain confidental and/or
> privileged information and is intended for use by the indicated addressee
> only. If you have received this message in error, please notify the sender
> immediately, destroy the original message and any attachment and delete
> this message and any attachment from your system. Unauthorized use,
> distribution, disclosure, reproduction, or alteration of this e-mail
> message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts
> legally binding statements via e-mail unless otherwise stated. Considering
> that internet communication is not secured, Raiffeisenbank Austria d.d. is
> not responsible for the content of this message, for potential damage
> occured due to infection of this message with a virus or other malicious
> program, and for potential technical problems during delivery of this
> message.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: Please correct ids to be unique among all your routes.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel and Spring Boot do you use?
And can you maybe put your sample project on github or something so we
can take a look there and try it out

On Tue, Mar 20, 2018 at 6:59 PM,  <hr...@rba.hr> wrote:
> Hi,
>
> if I try to build this code:
>
> package org.mycompany;
>
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.model.rest.RestParamType;
>
>
> public class MyFirstRouterBuilder extends RouteBuilder {
>      @Override
>     public void configure() throws Exception {
>         try{
>         restConfiguration().component("servlet");
>             rest()
>             .get("/accounts/{accountId}/transactions").id("r1")
>                 .param()
>                     .name("accountId")
>                     .type(RestParamType.path)
>                     .dataType("string")
>                     .required(true)
>                 .endParam()
>                 .to("direct:rest1");
>
>                 from("direct:rest1")
>                  .log("${body}");
>
>         }catch(Exception e){
>
>         }
>      }
> }
>
> I receive:
>
> org.apache.camel.spring.boot.CamelSpringBootInitializationException:
> org.apache.camel.FailedToStartRouteException: Failed to start route r1
> because of duplicate id detected: r1. Please correct ids to be unique
> among all your routes.
>
> If I add .routeId("r2") or .id("r2") to the second route, immediately
> after from("direct:rest1"), nothing changes.
>
> If I remove .id("r1") from the rest get operation, I receive:
>
> org.apache.camel.spring.boot.CamelSpringBootInitializationException:
> org.apache.camel.FailedToStartRouteException: Failed to start route route1
> because of duplicate id detected: route2. Please correct ids to be unique
> among all your routes.
>
> How is this supposed to be written in order to avoid that error?
> I inject that into camel context like this:
>
>     <bean class="org.mycompany.MyFirstRouterBuilder" id="myFirstRouter"/>
>     <camelContext id="camel" useBreadcrumb="false" xmlns="
> http://camel.apache.org/schema/spring">
>         <routeBuilder ref="myFirstRouter"/>
>     </camelContext>
> ______________________
>
> Napomena:
> Ova elektronička poruka i njeni prilozi mogu sadržavati povjerljive i/ili povlaštene informacije, a namijenjena je isključivo za upotrebu naznačenog primatelja. Ako ste ovu poruku primili greškom, molimo Vas da o tome bez odlaganja obavijestite pošiljatelja, da uništite izvornu poruku i njene priloge i bez odlaganja poruku i njene priloge izbrišete iz Vašeg sistema. Neovlaštena uporaba, distribucija, otkrivanje, umnožavanje ili izmjena ove poruke je zabranjena. Raiffeisenbank Austria d.d. ne daje niti ne prihvaća pravno obvezujuće izjave putem elektroničkih poruka osim ukoliko drugačije nije izričito navedeno. Budući da komunikacija internetom nije zaštićena, Raiffeisenbank Austria d.d. ne prihvaća odgovornost za sadržaj ove poruke, kao ni za eventualnu štetu nastalu zbog zaraženosti ove poruke virusom ili drugim štetnim programom, te zbog eventualnih tehničkih problema prilikom dostave ove poruke.
>
> Disclaimer:
> This e-mail message and any attachment may contain confidental and/or privileged information and is intended for use by the indicated addressee only. If you have received this message in error, please notify the sender immediately, destroy the original message and any attachment and delete this message and any attachment from your system. Unauthorized use, distribution, disclosure, reproduction, or alteration of this e-mail message is forbidden. Raiffeisenbank Austria d.d. neither makes nor accepts legally binding statements via e-mail unless otherwise stated. Considering that internet communication is not secured, Raiffeisenbank Austria d.d. is not responsible for the content of this message, for potential damage occured due to infection of this message with a virus or other malicious program, and for potential technical problems during delivery of this message.



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