I'm pretty sure that while DS supports
the service factory concept, your component implementation class does not
need to implement org.osgi.framework.ServiceFactory
and MUST implement each of its provided service interfaces. Please
give that a try.
Alternatively, please repost to the
mailing list quoting the sections of the OSGi spec that say that the component's
implementation class must implement org.osgi.framework.ServiceFactory.
"Dutton, Faron G"
<faron.dutton@xxxxxx> Sent by: equinox-dev-bounces@xxxxxxxxxxx
01/25/2009 01:31 PM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
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:
a service object that is not an instance of the service class sample.ServiceInterface"
This appears to be a bug. Am I correct or, if not, what am I doing wrong?
equinox-dev mailing list