Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13197

Route failed to start route because of duplicate id detected

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 2.18.3
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      spring-boot-test: 1.4.2

      camel version :  2.18.3

       

       

    • Estimated Complexity:
      Unknown

      Description

      There are no duplicate routes in actual. When the application runs in standalone no issues.

       

      But in case of testing;

      1. already UTs are there in place for route testing. In those Ut classes route builder beans are added under SingleRouteCamelConfiguration.
      2. When i add an integration test class for spring boot level testing using @SpringBootTest, the application fail to start due to route id duplication.

       

      However, If i remove all the existing UT test classes, then no issues.

       

      Could you please help me to get some workaround. 

       

       

      Log: 

       

      Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
      2019-02-14 00:42:35.060 ERROR 21856 — [ main] o.s.boot.SpringApplication : Application startup failed

      org.apache.camel.spring.boot.CamelSpringBootInitializationException: org.apache.camel.FailedToStartRouteException: Failed to start route routeXYZ because of duplicate id detected: routeXYZ . Please correct ids to be unique among all your routes.
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:124)
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:41)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383)
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337)
      at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
      at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:111)
      at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
      at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
      at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
      at au.com.dius.pact.provider.spring.SpringRestPactRunner.getPactSource(SpringRestPactRunner.kt:46)
      at au.com.dius.pact.provider.junit.PactRunner.<init>(PactRunner.kt:69)
      at au.com.dius.pact.provider.junit.RestPactRunner.<init>(RestPactRunner.kt:8)
      at au.com.dius.pact.provider.spring.SpringRestPactRunner.<init>(SpringRestPactRunner.kt:18)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
      at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:87)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:73)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:46)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
      Caused by: org.apache.camel.FailedToStartRouteException: Failed to start route routeXYZ  because of duplicate id detected: routeXYZ . Please correct ids to be unique among all your routes.
      at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:973)
      at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3401)
      at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3132)
      at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:183)
      at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2961)
      at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2957)
      at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2980)
      at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2957)
      at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2924)
      at org.apache.camel.spring.boot.RoutesCollector.maybeStart(RoutesCollector.java:141)
      at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:116)
      ... 37 common frames omitted

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Madhav Madhav
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: