On 7/13/09 2:47 PM, Markus Michel wrote:
Hi there!

Today I wanted to add the eventadmin service to my OSGi environment.
Therefore I extended the import block of my bundle, which is created within
an eclipse equinox project,  with org.osgi.service.event. After loading the
service I tried to access it by running the following command:

         // get service reference to event admin service
         serviceReference =
bundleContext.getServiceReference(EventAdmin.class.getName());

         // check if service reference is valid
         if (serviceReference != null)
         {
             eventAdmin = (EventAdmin)
bundleContext.getService(serviceReference);
         }

But inside the if-loop I'm getting an error:

java.lang.ClassCastException:
org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator cannot
be cast to org.osgi.service.event.EventAdmin

I'm a little bit confused now, because I thought that the Apache Felix
framework is fully compatible to the OSGi specifications?!?

While the Felix framework isn't yet 100% compliant, it is very close and getting closer every release.

Isn't it
possible to mix equinox components (my bundle) with felix components (the
eventadmin service)?

Does anybody has an idea how I can solve my problem?

Such a scenario should work, but you didn't provide enough information to say why it isn't. Perhaps you could show us your bundle's manifest file as well as a "jar tf" of the bundle.

-> richard

BR,

Markus


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

Reply via email to