Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "Failed to create route route1 exception" in Apache Camel?

I am new for Apache Camel concept. I have tried to write sample code using with apache camel API's and I am getting the following exception when try to run the code.

Can anyone help me to solve this issue?

Here's the sample code and an exception as well,

Sample Code :

 CamelContext context = new DefaultCamelContext();
 context.addRoutes(new RouteBuilder() { 
  public void configure() {
    from("direct:start")
    .setHeader(Exchange.HTTP_URI,simple("`http://sample-host:8080/demo/get`"))
    .to("http://emptyhost");
  }
 });
 context.start();
 ProducerTemplate template = context.createProducerTemplate();
 System.out.println(template.requestBodyAndHeaders("direct:start", null, null,String.class));

Exception :

Exception in thread "main" org.apache.camel.FailedToCreateRouteException: 
Failed to create route route1 at: 
    >>> To[`http://sample-host:8080/demo/get`] <<< 
in route: Route(route1)
    [[From[direct:start]] -> [`To[http://sample-host:8`…
because of 
    Failed to resolve endpoint: `http://sample-host:8080/demo/get`
due to: 
    No component found with scheme: http
like image 283
Azhaguvel A Avatar asked Feb 15 '14 18:02

Azhaguvel A


People also ask

How does Apache Camel route work?

A Camel route is where the integration flow is defined. For example to integrate two systems then a Camel route can be coded to specify how these systems are integrated. An example could be to take files from a FTP server and send to a ActiveMQ messaging system.

What is Route ID in Apache Camel?

routeId() are for identifying routes. By adding ids you can in your tests use adviceWith() to mock or inject or remove parts of your route to perform automated tests without having access to backend systems.

What is camel route builder?

The RouteBuilder is a base class which is derived from to create routing rules using the DSL. Instances of RouteBuilder are then added to the CamelContext .


1 Answers

Dependency libraries were missing. So i have added those libraries and solved my issue.

like image 159
Azhaguvel A Avatar answered Nov 05 '22 05:11

Azhaguvel A