Thanks again Raymond,

start ordering was ok, I mean that I have Apache Aries with a start order of 4 and my bundle with 5, I actually can see Apache Aries see my Service, please take a look to the attached piacture, it is a screenshot from my Felix console, where it's clear that Aries recognizes the service provider.

These kind of problems are really frustrating and are the main cause of OSGI abandonment by my company, we are very tired to spend a lot of time to find workaround for class loading issues

Thanks again, bye

Raffaele Gambelli
WebRainbow® Software Analyst & Developer

Hitachi Systems CBT
r.gambe...@hitachi-systems-cbt.com | Phone +39 051 8550 576
Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno
www.hitachi-systems-cbt.com

This email for the D.Lgs n.196/2003 (Privacy Code), may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient, you must not use, copy, disclose or take any action based on this message or any information here. If you have received this email in error, please contact us (e-mail: priv...@hitachi-systems-cbt.com) by reply e-mail and delete all copies. Legal privilege is not waived because you have read this e-mail. Thank you for your cooperation.


-----Raymond Auge <raymond.a...@liferay.com> ha scritto: -----
Per: Raffaele Gambelli <r.gambe...@hitachi-systems-cbt.com>
Da: Raymond Auge <raymond.a...@liferay.com>
Data: 14/06/2018 08.49PM
Cc: OSGi Developer Mail List <osgi-dev@mail.osgi.org>
Oggetto: Re: [osgi-dev] Migrating existing projects to OSGi, ServiceLoader

One other thing you could check is the starting order of your bundles. Most things that use weaving hooks (SpiFly does) is subject to start ordering.

so make sure SpiFly is started before the bundles it weaves.

Sincerely,
- Ray

On Thu, Jun 14, 2018 at 5:57 AM, Raffaele Gambelli < r.gambe...@hitachi-systems-cbt.com> wrote:
Hello Raymond and thank you,

yes we know exactly that it is used the  single argument ServiceLoader constructor and yes we think to have followed all steps showed in Apache Aries SPI Fly doc.
Felix console shows our bundles and their services, so it seems all right, but when invoking the constructor it logs error not finding any implementation, here follows the ServiceLoader invocation made in the third party library:

static {
ServiceLoader<IUtils> loader = ServiceLoader.load(IUtils. class);
Iterator<IUtils> iterator = loader.iterator();
if (!iterator.hasNext()) {
throw new ExceptionInInitializerError(
"No implementation found for IUtils in classpath, please choose between dss-utils-apache-commons or dss-utils-google-guava");
}
impl = iterator.next();
}

Thanks, bye

Raffaele Gambelli
WebRainbow® Software Analyst & Developer

Hitachi Systems CBT
r.gambelli@hitachi-systems-cbt.com | Phone +39 051 8550 576
Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno
www.hitachi-systems-cbt.com

This email for the D.Lgs n.196/2003 (Privacy Code), may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient, you must not use, copy, disclose or take any action based on this message or any information here. If you have received this email in error, please contact us (e-mail: privacy@hitachi-systems-cbt.com) by reply e-mail and delete all copies. Legal privilege is not waived because you have read this e-mail. Thank you for your cooperation.


-----Raymond Auge < raymond.a...@liferay.com> ha scritto: -----
Per: Raffaele Gambelli < R.Gambelli@hitachi-systems-cbt.com>, OSGi Developer Mail List < osgi-dev@mail.osgi.org>
Da: Raymond Auge < raymond.a...@liferay.com>
Data: 13/06/2018 03.48PM
Oggetto: Re: [osgi-dev] Migrating existing projects to OSGi, ServiceLoader

Hello Raffaele,

Have you read through the this page starting with http://aries.apache.org/modules/spi-fly.html#making-it-work

Also, do you know exactly which ServiceLoader method is used in the Service Interface bundle? (it has to be the single argument ServiceLoader.load(Class) method to work with the OSGi standardized approach).

Sincerely,
- Ray

On Wed, Jun 13, 2018 at 5:50 AM, Raffaele Gambelli via osgi-dev <osgi-dev@mail.osgi.org > wrote:
Hi all,

I would like to use a third party library in my Equinox, it makes use of ServiceLoader to loade an implementation coming from a different jar.

I created a bundle containing:
- my code which calls third party jar
- the third party jar containing the Service interface
- the third party jar containing the Service implementation
- the require and provide capability as suggested in Aries SPI Fly

I can see in my Felix console that bundle is active and I can see its service id, nevertheless when I invoke the getInstance of my class which in turn calls the third party code which calls ServiceLoader.load, the concrete class is not found :-(

Any help woulb be appreciated, thanks in advance, bye

Raffaele Gambelli
WebRainbow® Software Analyst & Developer

Hitachi Systems CBT
r.gambe...@hitachi-systems-cbt.com | Phone +39 051 8550 576
Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno
www.hitachi-systems-cbt.com

This email for the D.Lgs n.196/2003 (Privacy Code), may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient, you must not use, copy, disclose or take any action based on this message or any information here. If you have received this email in error, please contact us (e-mail: priv...@hitachi-systems-cbt.com) by reply e-mail and delete all copies. Legal privilege is not waived because you have read this e-mail. Thank you for your cooperation.
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev



--
Raymond Augé (@rotty3000)
Senior Software Architect  Liferay, Inc.  (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance (@OSGiAlliance)



--
Raymond Augé (@rotty3000)
Senior Software Architect  Liferay, Inc.  (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance (@OSGiAlliance)
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to