• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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
Hi,
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.

Project-Structure.png
[Thumbnail for Project-Structure.png]
 
Greenhorn
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
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic