[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] EventAdmin ServiceReference is always null?

Also note that your coding will require that the event admin bundle be 
started before your bundle. If the reverse is true, you will still get a 
null. You should not write your code to be sensitive to start orderings 
between bundles and you should also pay attention to service dynamics: 
that is the event admin service could be unregistered if the event admin 
bundle is stopped or updated.

Please consider using the ServiceTracker class or Declarative Services to 
obtain and manage your dependencies on services. These technique handle 
the dynamics of services and can avoid dependencies on bundle start 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
Office: +1 407 849 9117 Mobile: +1 386 848 3788

"Cameron Ross" <cross@xxxxxxxxxxxxxxxx> 
Sent by: equinox-dev-bounces@xxxxxxxxxxx
2006-05-12 09:28 AM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>


[equinox-dev] EventAdmin ServiceReference is always null?

I am unable to obtain a valid ServiceReference for the EventAdmin service 
shipped with 3.2RC3.  The start method in my Activator class looks like 
public void start(BundleContext context) throws Exception {
    ServiceReference serviceRef = 
    // serviceRef is always null!
The following items are selected in both the Eclipse 
"Window->Preferences->Plug-in Development->Target Platform->Plug-ins" and 
"Run->Run...->Plug-ins->Target Platform" areas:
  - org.eclipse.equinox.log(1.0.0.v20060206)
  - org.eclipse.osgi(3.2.0.v20060505)
  - org.eclipse.osgi.services(
My manifest contains the following header and everything compiles nicely:
    Import-Package: org.osgi.framework, org.osgi.service.event, 
I'm running Eclipse 3.2-RC3 (Version 3.2.0, Build ID I20060505-1306) with 
Sun's JRE 1.5.0_06 on Windows XP Professional SP2. 
Note that I am able to get a ServiceReference to the LogService.  Any help 
is greatly appreciated.
Cameron Ross.
equinox-dev mailing list