Have been able to resolve my issue. The SPI consumer was not weaved as defined in Aries SPI documentation
On Thu, Sep 6, 2012 at 8:57 AM, Charles Moulliard <[email protected]> wrote: > Hi, > > I deploy on Apache Karaf 2.2.7 a project where the code use ServiceLoader > of JDK. To turn it on this mechanism on Karaf, I have followed the > instruction defined here ( > http://coderthoughts.blogspot.be/2011/08/javautilserviceloader-in-osgi.html) > and here (http://aries.apache.org/modules/spi-fly.html). The SPI provider > is well registered : > > 2012-09-06 08:24:54,485 | INFO | l Console Thread | bundle > | 87 - org.apache.aries.spifly.static.bundle - 1.0.0.SNAPSHOT | > Bundle Considered for SPI providers: > org.apache.deltaspike.cdictrl.deltaspike-cdictrl-weld > 2012-09-06 08:24:54,486 | INFO | l Console Thread | bundle > | 87 - org.apache.aries.spifly.static.bundle - 1.0.0.SNAPSHOT | > Examining bundle for SPI provider: > org.apache.deltaspike.cdictrl.deltaspike-cdictrl-weld > 2012-09-06 08:24:54,487 | INFO | l Console Thread | bundle > | 87 - org.apache.aries.spifly.static.bundle - 1.0.0.SNAPSHOT | > Found SPI resource: > bundle://65.1:0/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer > 2012-09-06 08:24:54,487 | INFO | l Console Thread | bundle > | 87 - org.apache.aries.spifly.static.bundle - 1.0.0.SNAPSHOT | > Loaded SPI provider: class > org.apache.deltaspike.cdise.weld.WeldContainerControl > 2012-09-06 08:24:54,488 | INFO | l Console Thread | bundle > | 87 - org.apache.aries.spifly.static.bundle - 1.0.0.SNAPSHOT | > Registered service: > org.apache.felix.framework.ServiceRegistrationImpl@655538e5 > 2012-09-06 08:24:54,489 | INFO | l Console Thread | bundle > | 87 - org.apache.aries.spifly.static.bundle - 1.0.0.SNAPSHOT | > Registered provider: org.apache.deltaspike.cdise.api.CdiContainer in bundle > org.apache.deltaspike.cdictrl.deltaspike-cdictrl-weld > > deltaspike-cdictrl-weld (65) provides: > -------------------------------------- > .org.apache.aries.spifly.provider.implclass = > org.apache.deltaspike.cdise.weld.WeldContainerControl > objectClass = org.apache.deltaspike.cdise.api.CdiContainer > service.id = 30 > serviceloader.mediator = 87 > > but When the client (through an Activator class) tries to consume the > service, it is not able to find the service > > public class Activator implements BundleActivator > { > > private static CdiContainer cdiContainer = null; > > public void start(BundleContext context) throws Exception > { > ServiceLoader<CdiContainer> cdiContainerLoader = > ServiceLoader.load(CdiContainer.class); > Iterator<CdiContainer> cdiIt = cdiContainerLoader.iterator(); > if (cdiIt.hasNext()) // IS EMPTY > > > deltaspike-cdictrl-api (64) > --------------------------- > SPI-Consumer = * > Bundle-Activator = org.apache.deltaspike.cdise.api.Activator ? > > > What could be the issue ? > > Regards, > > -- > Charles Moulliard > Apache Committer / Sr. Pr. Consultant at FuseSource.com > Twitter : @cmoulliard > Blog : http://cmoulliard.blogspot.com > > > -- Charles Moulliard Apache Committer / Sr. Pr. Consultant at FuseSource.com Twitter : @cmoulliard Blog : http://cmoulliard.blogspot.com
