• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Using Apache Camel with Spring

Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been learning the Apache Camel with "Camel In Action" book. I am total new bee to this. I was working with some of the application examples provided with the book. In that I am trying my hands on a particular example where the Custom Route Builder class is autowired and should be added to the camel context. But this is not working as expected. I have provided the code below. Please help.

1. OrderRouteBuilder.java

1. OrderRouterWithFilter

3. beans.xml

4. Added attachment as Project Structure

I am using Apache Maven 3.2.3 as Build Tool for all the required jar configurations.

5. pom.xml

Please help with this. Even with all these it's raising an NPE at context.addRoute(orderRouteBuilder) statement.

[Thumbnail for Project-Structure.png]
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dilip,
I am new to this also but this might help
Add the following code to your work() instead of CamelContext context = new DefaultCamelContext ();

ApplicationContext springcontext = new FileSystemXmlApplicationContext("src/main/resources/beans.xml");
CamelContext context = springcontext.getBean("camel", CamelContext.class);

Please let me know if that helped
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic