3 Replies Latest reply on Aug 20, 2008 4:51 AM by Tomasz Kaczanowski

    esb 4.0 preview - BundleActivator vs. beans.xml

    Tomasz Kaczanowski Newbie

      Hello,

       

      Gert thanks for your answers so far. I think I'll keep you busy with my questions for a while.

       

      I've tried to do some simple stuff with osgi bundles (which are new to me). I followed apache felix tutorial (http://felix.apache.org/site/apache-felix-osgi-tutorial.html).

       

      I've tried to deploy first bundle, register it (using BundleActivator or beans.xml) and then deploy second bundle, which would discover the first one (using context.getServiceReference(...)). But I've failed on this.

       

      It looks like the first bundle is deployed correctly (from what I can see in logs). It loooks the same if I use BundleActivator (context.registerService(...)) or beans.xml (<osgi:service ... />).

       

      But than I deploy second bundle, and it has a piece of code like this:

      public void start(BundleContext context) throws Exception {

      ServiceReference ref = context.getServiceReference(

                     MyInterface.class.getName());

              if (ref == null ) {

                  System.out.println("nothing found");

                  System.out.println("nothing found");

                  System.out.println("nothing found");

                  System.out.println("nothing found");

                  System.out.println("nothing found");

                  System.out.println("nothing found");

              } else {

                      System.out.println("ref: " + ref);

              } and "nothing found" is printed

       

      Is what I'm trying to do impossible in ESB 4.0 ? Or maybe the idea is ok, but I do some mistakes ?

       

      best regards

      Tomek Kaczanowski