Mahnoor Fatima
Mahnoor Fatima

Reputation: 105

Apache camel maven project addRouteBuilder not found

I have created a new project with maven archetype apache-camel but after building project I am getting an error when adding a route builder. Hereby you can find the code:

import org.apache.camel.main.Main; 

Main main = new Main(); 
main.addRouteBuilder(new MyRouteBuilder());
main.run(args);

and below the error I get:

Error: java: cannot find symbol symbol: method addRouteBuilder

I am completely new and after trying for hours couldn't figure out what is wrong. Kindly guide me

Upvotes: 2

Views: 1762

Answers (1)

KAhmed
KAhmed

Reputation: 108

I had the same issue today. The IntelliJ code generator is wrong.

Change the code as below

from

main.addRouteBuilder(new MyRouteBuilder());

To

main.configure().addRoutesBuilder(new MyRouteBuilder());

NOTE: its addRoute"s"Builder not addRouteBuilder

Upvotes: 7

Related Questions