Vincent, what is the mechanism you are using to get the service? If you can use a service filter, then you can easily filter on the bundle id of the service. Bundle id is a required property of services.
It's simple to do this using a service tracker, but not simple with DS (DS doesn't have a mechanism to let your write a target filter using local bundle information as criteria, if so the solution would have been trivial). So, each of the bundles could start a service tracker which merely filters on their own bundle id. - Ray On Fri, Jun 17, 2016 at 8:58 AM, Clement Escoffier < [email protected]> wrote: > Hi, > > You may be able to achieve what you want with a composites: > > http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-composition-tutorial.html > < > http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-composition-tutorial.html > > > > http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/ipojo-hierarchical-composition-overview.html > < > http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/ipojo-hierarchical-composition-overview.html > > > > > Regards, > > Clement > > > On 17 juin 2016, at 12:27, Vincent Vandemeulebrouck < > [email protected]> wrote: > > > > I need two different bundles to have the same private iPojo service, to > be > > used internally. It is defined in a shared library, included in both > bundle. > > > > How can I enforce that the requiring service get the service from their > own > > bundle? > > > > Currently, as each bundle has the same service and same specifications, I > > end-up having the private service from the other bundle injected, causing > > some illegal accesses. > > > > Bundles are implemented in java. The issue is that each bundle has its > own > > ClassLoader, and injecting the class from the othe ClassLoader causes a > > ClassCastException. > > > > > > *--Vincent Vandemeulebrouck | *Architect - UL MIDDLE and Extensions *| > > ULLINK | *D: +33 1 44 50 52 02* | *T: +33 1 49 95 30 00* | *23-25 rue de > > Provence, 75009 Paris, FRANCE *|* [email protected] > *| * > > > > -- > > *The information contained in or attached to this email is strictly > > confidential. If you are not the intended recipient, please notify us > > immediately by telephone and return the message to us.* > > -- *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile> (@rotty3000) Senior Software Architect *Liferay, Inc.* <http://www.liferay.com> (@Liferay) Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

