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?!? 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?
BR,
Markus