I am using Eclipse 3.4.1 with org.eclipse.equinox.ds 1.0.0 and I have the 
following declarative service registered as a service factory.

<component name="unique.component.name">
  <implementation class="sample.ServiceFactory"/>
  <service servicefactory="true">
    <provide interface="sample.ServiceInterface"/>
  </service>
</component>

The class sample.ServiceFactory implements org.osgi.framework.ServiceFactory 
instead of sample.ServiceInterface. When Equinox parses the XML, it creates an 
instance of FactoryReg instead of ServiceReg. When time comes to actually 
instantiate an instance of sample.ServiceInterface, I expected FactoryReg to 
create an instance of sample.ServiceFactory then invoke the getService(Bundle, 
ServiceRegistration) method of sample.ServiceFactory, which would create the 
service object. My understanding of the OSGi spec confirms this. FactoryReg, 
instead, creates and returns an instance of sample.ServiceFactory. This causes 
an java.lang.IllegalArgumentException:
"org.eclipse.equinox.internal.ds.FactoryReg.getService() returned a service 
object that is not an instance of the service class sample.ServiceInterface"
in ServiceUse.getService(ServiceUse.java:148).

This appears to be a bug. Am I correct or, if not, what am I doing wrong?

Faron

_______________________________________________
equinox-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to