0 Replies Latest reply on Nov 19, 2015 2:32 PM by scotta64

    Missing component when reading resource file in bundle

    scotta64

      I'm attempting to read some property values into a java bean to make the values available to various other classes in my Camel route.  This post http://stackoverflow.com/questions/16401676/osgi-blueprint-how-to-read-resource-file-in-bundle gives me a good clear answer of how to do so.  My blueprint.xml file contains this node

       

      <bean id="PropertyBean"

          class="org.myorg.properties.Properties"

          scope="singleton" init-method="start">

          <property name="bundle" ref="blueprintBundleContext" />

      </bean>

       

      And my Properties class contains the following start() method

       

      public void start() {

          properties = new Properties();

          try {

              InputStream stream = this.getBundle().getResource("org.trinityhealth.services.connector.workday").openStream();

              properties.load(stream);

          } catch (Exception e) {

              logger.error("error reading properties file");

              try {

                  bundle.stop();

              } catch (Exception e2) {

                  logger.error("unable to stop container");

              }

          }

      }

       

      When I deploy this bundle to a Fuse container, the following error is thrown

       

      org.osgi.service.blueprint.container.NoSuchComponentException: No component with id 'org.apache.aries.managedObjectManager' could be found

        at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:750 (...long stack trace follows).

       

      In reading the source code for the BlueprintContainerImpl object, the only situation that should cause this particular exception to be thrown is if the component repository happens to be null.  Which leads me to think I'm missing some sort of startup or initialization step.  But i can't for the life of me figure out what that step might be.  Please, anyone who's seen this before tell me "Oh, just add 'init' to your blueprint.xml" or whatever the doubtless simple solution is to this problem.  Thx.