2 Replies Latest reply on Mar 8, 2012 4:07 AM by Jean-Yves Terrien

    How to get a resource from a bundle when it is created via blueprint?

    Jean-Yves Terrien Newbie



      I have a bundle created  using the camel-archetype-archetype blueprint.

      my project contains only two elements

      class road builder and a property file.


      the blueprint définition is



      the RouteBuilder in fr.phe.transfo is simply derived from the class of Camel RouteBuilder that implemented the method "configure"

      In constructor method I try to read my file myProperties.properties

      package fr.phe.transfo;


      import java.net.URL;


      public class RouteBuilder extends org.apache.camel.builder.RouteBuilder {



           public RouteBuilder() {


                URL url = getClass().getClassLoader().getResource("myProperties.properties");




           public void configure() {

                // do some things with the properties






      the package is correct and contains the properties file.


      I tried



      BundleDelegatingClassLoader.getSystemResource("myfile"); //:(


      all these methods cause a NullPointerException.


      I think I need to get the bundle context to search in the bundle, the resource.

      But I do not know how.


      How to get a resource from a bundle when it is created via blueprint?



      PS: Sorry for my approximative english.