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

"There are no outputs which matches: * in the route" when OnException is used in the Route with weaving

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 2.16.2
    • Fix Version/s: None
    • Component/s: camel-blueprint, camel-test
    • Labels:
      None
    • Environment:

      Karaf, Camel

    • Estimated Complexity:
      Unknown

      Description

      I have a route which is using onException. When I wrote a CBTS with weaving, test is failing with the below exception. I could reproduce using a sample route. Please have a look:

      Exception received:

      java.lang.IllegalArgumentException: There are no outputs which matches: * in the route: Route(foo)[[From[direct:start]] -> [OnException[[class java.lang.Exception] -> [SetHeader[error, constant

      Unknown macro: {true}

      ], Stop]], pipeline -> [[To[mock://result], Stop]]]]

      Here is the Sample Route and Test class to reproduce.

      public class OnExceptionRouteIdTest extends CamelBlueprintTestSupport {
      
      	private static final String START = "direct:start";
      
      	@Override
      	public boolean isUseAdviceWith() {
      		return true;
      	}
      
      	@Override
      	protected String getBlueprintDescriptor() {
      		return "OSGI-INF/blueprint/success.xml";
      	}
      
      	@Override
      	protected RouteBuilder createRouteBuilder() {
      		return new OnExceptionRouteIdRouteBuilder();
      	}
      
      
      
      	@Override
      	protected CamelContext createCamelContext() throws Exception {
      		final CamelContext camelContext = super.createCamelContext();
      		camelContext.setTracing(true);
      		camelContext.addComponent("activemq", new StubComponent());
      		return camelContext;
      	}
      
      	@Test
      	public void testOnExceptionRouteId() throws Exception {
      		final MockEndpoint end = getMockEndpoint("mock:result");
      
      		context.getRouteDefinition("foo").adviceWith(context, new AdviceWithRouteBuilder() {
      
      			@Override
      			public void configure() throws Exception {
      				replaceFromWith(START);
      				//weaveById("toTestWeaving").replace().to(end).stop();
      				interceptSendToEndpoint("mock:foo")
      					.skipSendToOriginalEndpoint()
      					.to("mock:out");
      				weaveAddLast().to(end);
      			}
      		});
      
      		context.start();
      	}
      
      }
      
      public class OnExceptionRouteIdRouteBuilder extends RouteBuilder {
      
      	@Override
      	public void configure() throws Exception {
      		onException(Exception.class).id("myError")
      			.maximumRedeliveries(0)
      			.handled(true)
      			.setHeader("error", constant("true"))
      			.end()
      			.stop();
      
      		from("direct:foo").routeId("foo")
      			.to("mock:foo").id("toTestWeaving")
      			.end();
      	}
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              srinivas@live.com Srinivas
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: