Blueprint service factory does not implement required interfaces
Issue
I am trying to use ServiceFactory in blueprint to register a service and here is what the blueprint looks like:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="HelloFactory" class="org.jboss.fuse.servicefactory.impl.HelloServiceFactory" />
<service ref="HelloFactory" interface="orb.jboss.fuse.servicefactory.HelloService" />
</blueprint>
Where HelloServiceFactory is an implementation of org.osgi.framework.ServiceFactory to provide a service HelloService:
public class HelloServiceFactory implements ServiceFactory<HelloService> {
@Override
public HelloService getService(Bundle bundle, ServiceRegistration serviceRegistration) {
return new HelloServiceImpl(bundle.getBundleId(), bundle.getSymbolicName());
}
@Override
public void ungetService(Bundle bundle, ServiceRegistration<HelloService> serviceRegistration, HelloService helloSrv) {
}
}
And HelloService is a very simple interface:
public interface HelloService {
public String say();
}
Obviously, HelloServiceImpl is an implementation of HelloService interface:
public class HelloServiceImpl implements HelloService {
…
}
However, above blueprint gives an error when deployed to JBoss Fuse 6.1 container:
09:19:08,035 | ERROR | l Console Thread | ServiceRecipe | 9 - org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | Error retrieving service from ServiceRecipe[name='.component-1']
org.osgi.service.blueprint.container.ComponentDefinitionException: The service implementation does not implement the required interfaces: [org.jboss.fuse.servicefactory.HelloService]
Environment
- JBoss Fuse
- 6.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.