There is something going wrong in your setup. Are you sure your monitoring bundle is getting activated? Did you specify Bundle-Activator in your manifest?

I created a bundle like yours and it worked fine for me:

g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.3.0.SNAPSHOT)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    2|Active     |    1|Apache Felix Gogo Command (0.12.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    7|Active     |    1|service.listener.text (0.0.0)
g! stop 1
**serviceChanged called
**serviceChanged called
g! start 1
**serviceChanged called
**serviceChanged called
g!

-> richard

On 2/13/13 09:07 , Imóveis Nacionais wrote:
yes, I can install the related 'client bundle' and call the service on the
server bundle:



         ServiceReference sr  =
context.getServiceReference(upnp.class.getName());
         if(sr != null)
         {
           upnp x = (upnp)context.getService(sr);
           if(x != null)
           {
                 System.out.println("Vai chamar o serviço HelloToYou...");
                 int n=x.GetNumber();
                 System.out.println("Vai libertar serviço HelloToYou... "+n);
                 context.ungetService(sr);

This code from related 'client' bundle works.

I also checked the export packages of the used server bundle and both
interface and bundle are marked for exportation

Alex



On Wed, Feb 13, 2013 at 1:49 PM, Richard S. Hall <[email protected]>wrote:

Are you sure the server bundle is providing its service?

-> richard


On 2/13/13 08:36 , Imóveis Nacionais wrote:

Hi
I am trying to play with service events in a client bundle in order to be
notified when other bundles are registered.

So, I created a simple maven osgi bundler just with an activator class.

public class Activator implements BundleActivator, ServiceListener
{

      public void start(BundleContext context) throws Exception
      {
              System.out.println("Client bundle initializing on start
method...");

              context.addServiceListener(**this);


      public void stop(BundleContext context) throws Exception
      {
          context.removeServiceListener(**this);
      }

      public void serviceChanged(ServiceEvent event)
      {
          System.out.println("**serviceChanged called");
      }

Then, in the gogo shell of felix I installed this client bundle and
started
it. Then I installed other (server) bundle and started it but the
serviceChanged handler is never called. Why?

Thanks a lot

Alex


------------------------------**------------------------------**---------
To unsubscribe, e-mail: 
users-unsubscribe@felix.**apache.org<[email protected]>
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to