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

IllegalArgumentException: Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 2.14.1
    • Fix Version/s: None
    • Component/s: camel-bindy
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I have written a test case as shown below. Though there are no system level dependencies, This case case never fails in my system but it fails in all other systems.

      @Test
          public void testSOTBlock() throws Exception {
              context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
      
                  @Override
                  public void configure() throws Exception {
                      interceptSendToEndpoint("file://*").skipSendToOriginalEndpoint().to("mock:file");
                  }
              });
      
              MockEndpoint mock = getMockEndpoint("mock:file");
              mock.expectedBodiesReceived(Arrays.asList("SOS:1;1;T00001;;5.00;;JANE;0;;0;;123456\r\n"));
      
              StartOfTransaction startOfSale = new StartOfTransaction(purchase, 1, 1, 1);
              template.sendBodyAndHeader("direct:toSOT", startOfSale, "flightKey", 123456);
              assertMockEndpointsSatisfied();
          }
      

      Below is the test case error log.

      org.apache.camel.FailedToCreateRouteException: Failed to create route route17: Route(route17)[[From[no uri or ref supplied!]] -> [process[c... because of Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext@a7720c2
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:192)
      	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:805)
      	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2174)
      	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1906)
      	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1767)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1735)
      	at org.apache.camel.test.junit4.CamelTestSupport.startCamelContext(CamelTestSupport.java:477)
      	at org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:311)
      	at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:217)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext@a7720c2
      	at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:135)
      	at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
      	at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:89)
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:923)
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187)
      	... 36 more
      
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              sunil4uing sunil
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: