|
Re: Providing interface as bundle with implementations as bundle [message #481003 is a reply to message #480998] |
Wed, 19 August 2009 10:34 |
|
Oliver Pfau schrieb:
> Hi,
>
> I try to do the following:
>
> - define bundle "ServiceInterface" which defines an interface
> - define bundle "ServiceImpl1" with Version 1.0.0 which implements the
> interface from "ServiceInterface"
> - deiine bundle "ServiceImpl2" with Version 1.0.1 which implements the
> interface from "ServiceInterface"
>
> "ServiceImpl1" and "ServiceImpl2" depending from "ServiceInterface"
I assume that the BSN of "ServiceImpl1" and "ServiceImpl2" are the same
and the one from "ServiceInterface" is totally different?
> I started equinox with the 3 bundles by EclipseStarter.startup(). The
> starting class has the version information to find the implementation that
> fits. The Problem is now, the starter class has another class loader than
> the bundles and the cast from the object delivered as service by
> "ServiceImpl1" or "ServiceImpl2" (depending on desired version) fails.
It looks like that you start Equinox from an outer application and you
want to access the OSGi service from this outer application. Is this
correct? If yes, then you need to ensure that the bundles within the
Equinox framework instance use the same interface class as the outer
application, i.e. you need to instruct Equinox to *not* load
"ServiceInterface" from the "ServiceInterface" bundle but from the outer
application's classpath.
ServiceInterface needs to be in its own package. This package needs to
be added to the 'org.osgi.framework.system.packages' property.
-Gunnar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03480 seconds