Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic