Hi Jean-Baptiste, I wasn't sure if this is a problem with iPojo or Karaf Cellar. As it's working with blueprint, I figured it is probably caused by iPojo, so I posted it here. Thanks for looking into it!
Best regards Matthias On Thu, Feb 12, 2015 at 8:38 AM, Jean-Baptiste Onofré <j...@nanthrax.net> wrote: > Hi Matthias, > > I would post such kind of message on the Karaf dev mailing list. > > Anyway, let me take a look. > > Regards > JB > > > On 02/12/2015 08:14 AM, Matthias Jeschke wrote: > >> Hi, >> >> I wanted to try out karaf cellar with iPojo, however, I ran into some >> problems. The (very simple) setup is as follows: >> >> The service interface bundle contains the service interface >> "MyRemoteService". >> >> package com.boxheadrobot.remoteservice.service; >> >> public interface MyRemoteService { >> String getOutput(); >> } >> >> The service implementation bundle contains a service implementation >> "MyRemoteServiceImpl". >> >> package com.boxheadrobot.remoteservice.service.impl; >> >> import com.boxheadrobot.remoteservice.service.MyRemoteService; >> import org.apache.felix.ipojo.annotations.Component; >> import org.apache.felix.ipojo.annotations.Instantiate; >> import org.apache.felix.ipojo.annotations.Provides; >> import org.apache.felix.ipojo.annotations.StaticServiceProperty; >> >> @Component >> @Provides(properties = {@StaticServiceProperty(name = >> "service.exported.interfaces", type = "java.lang.String", value = "*")}) >> @Instantiate >> public class MyRemoteServiceImpl implements MyRemoteService { >> >> @Override >> public String getOutput() { >> return "Node 1"; >> } >> } >> >> >> The service consumer bundle contains a single class that requires optional >> "MyRemoteServices". This is done using a @Bind(optional = true, aggregate >> = >> true) annotation. >> >> package com.boxheadrobot.remoteservice.consumer; >> >> import com.boxheadrobot.remoteservice.service.MyRemoteService; >> import org.apache.felix.ipojo.annotations.Bind; >> import org.apache.felix.ipojo.annotations.Component; >> import org.apache.felix.ipojo.annotations.Instantiate; >> import org.apache.felix.ipojo.annotations.Validate; >> import org.slf4j.Logger; >> import org.slf4j.LoggerFactory; >> >> @Component >> @Instantiate >> public class MyRemoteServiceConsumer { >> >> private static final Logger LOG = >> LoggerFactory.getLogger(MyRemoteServiceConsumer.class); >> >> @Validate >> public void start() { >> LOG.info("Starting consumer"); >> } >> >> @Bind(optional = true, aggregate = true) >> public void bindService(MyRemoteService service) { >> LOG.info("Service bound: {}", service); >> LOG.info("Service output: {}", service.getOutput()); >> } >> } >> >> When I deploy the bundles to karaf (cellar-dosgi), I get some really weird >> log messages. The service seems to be getting bound more than once and at >> one point a null service is bound: >> >> 2015-02-11 22:03:50,064 | INFO | pool-1-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> bound: >> com.boxheadrobot.remoteservice.service.impl.MyRemoteServiceImpl@7dddc24a >> 2015-02-11 22:03:50,089 | INFO | pool-1-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> output: >> Node 1 >> 2015-02-11 22:03:50,089 | INFO | pool-1-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> bound: >> com.boxheadrobot.remoteservice.service.impl.MyRemoteServiceImpl@7dddc24a >> 2015-02-11 22:03:50,089 | INFO | pool-1-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> output: >> Node 1 >> 2015-02-11 22:03:50,089 | INFO | pool-1-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Starting >> consumer >> 2015-02-11 22:03:54,657 | INFO | pool-13-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> bound: >> com.boxheadrobot.remoteservice.service.impl.MyRemoteServiceImpl@7dddc24a >> 2015-02-11 22:03:54,659 | INFO | pool-13-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> output: >> Node 1 >> 2015-02-11 22:04:09,641 | INFO | pool-13-thread-1 | >> MyRemoteServiceConsumer | 149 - >> com.boxheadrobot.remote-service-consumer - 1.0.0.SNAPSHOT | Service >> bound: >> null >> >> After this there comes an endless stream of error messages. There are >> printed out in rapid succession (as one can see from the timestamps): >> >> 2015-02-11 22:04:16,128 | ERROR | l-11-thread-3883 | >> EventDispatchTask | 136 - org.apache.karaf.cellar.core - >> 3.0.1 | Error while dispatching task >> org.osgi.service.blueprint.container.ServiceUnavailableException: The >> Blueprint container is being or has been destroyed: >> (objectClass=org.apache.karaf.cellar.core.event.EventTransportFactory) >> at >> org.apache.aries.blueprint.container.ReferenceRecipe. >> getService(ReferenceRecipe.java:240)[15:org.apache.aries. >> blueprint.core:1.4.2] >> at >> org.apache.aries.blueprint.container.ReferenceRecipe. >> access$000(ReferenceRecipe.java:55)[15:org.apache.aries. >> blueprint.core:1.4.2] >> at >> org.apache.aries.blueprint.container.ReferenceRecipe$ >> ServiceDispatcher.call(ReferenceRecipe.java:298)[15: >> org.apache.aries.blueprint.core:1.4.2] >> at Proxya79ac39f_dd86_4bde_a6ae_4820e8b9aafc.getEventProducer( >> Unknown >> Source)[:] >> at >> org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle( >> RemoteServiceCallHandler.java:99)[143:org.apache.karaf. >> cellar.dosgi:3.0.1] >> at >> org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle( >> RemoteServiceCallHandler.java:37)[143:org.apache.karaf. >> cellar.dosgi:3.0.1] >> at Proxy5b93b380_11e9_4f88_8322_dc1803383205.handle(Unknown >> Source)[:] >> at Proxycafc2557_966f_4434_98f6_44d1b9cf232f.handle(Unknown >> Source)[:] >> at >> org.apache.karaf.cellar.core.event.EventDispatchTask.run( >> EventDispatchTask.java:57)[136:org.apache.karaf.cellar.core:3.0.1] >> at >> java.util.concurrent.ThreadPoolExecutor.runWorker( >> ThreadPoolExecutor.java:1142)[:1.8.0_25] >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run( >> ThreadPoolExecutor.java:617)[:1.8.0_25] >> at java.lang.Thread.run(Thread.java:745)[:1.8.0_25] >> 2015-02-11 22:04:16,132 | ERROR | l-11-thread-3897 | >> EventDispatchTask | 136 - org.apache.karaf.cellar.core - >> 3.0.1 | Error while dispatching task >> org.osgi.service.blueprint.container.ServiceUnavailableException: The >> Blueprint container is being or has been destroyed: >> (objectClass=org.apache.karaf.cellar.core.event.EventTransportFactory) >> at >> org.apache.aries.blueprint.container.ReferenceRecipe. >> getService(ReferenceRecipe.java:240)[15:org.apache.aries. >> blueprint.core:1.4.2] >> at >> org.apache.aries.blueprint.container.ReferenceRecipe. >> access$000(ReferenceRecipe.java:55)[15:org.apache.aries. >> blueprint.core:1.4.2] >> at >> org.apache.aries.blueprint.container.ReferenceRecipe$ >> ServiceDispatcher.call(ReferenceRecipe.java:298)[15: >> org.apache.aries.blueprint.core:1.4.2] >> at Proxya79ac39f_dd86_4bde_a6ae_4820e8b9aafc.getEventProducer( >> Unknown >> Source)[:] >> at >> org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle( >> RemoteServiceCallHandler.java:99)[143:org.apache.karaf. >> cellar.dosgi:3.0.1] >> at >> org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle( >> RemoteServiceCallHandler.java:37)[143:org.apache.karaf. >> cellar.dosgi:3.0.1] >> at Proxy5b93b380_11e9_4f88_8322_dc1803383205.handle(Unknown >> Source)[:] >> at Proxycafc2557_966f_4434_98f6_44d1b9cf232f.handle(Unknown >> Source)[:] >> at >> org.apache.karaf.cellar.core.event.EventDispatchTask.run( >> EventDispatchTask.java:57)[136:org.apache.karaf.cellar.core:3.0.1] >> at >> java.util.concurrent.ThreadPoolExecutor.runWorker( >> ThreadPoolExecutor.java:1142)[:1.8.0_25] >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run( >> ThreadPoolExecutor.java:617)[:1.8.0_25] >> at java.lang.Thread.run(Thread.java:745)[:1.8.0_25] >> 2015-02-11 22:04:16,129 | ERROR | l-11-thread-3881 | >> EventDispatchTask | 136 - org.apache.karaf.cellar.core - >> 3.0.1 | Error while dispatching task >> >> Is there some error in my setup? On thing that seemed odd was that when I >> list all dosgi services using cluster:services-list, I see not only the >> MyRemoteService but also an iPojo service... >> >> > -- > Jean-Baptiste Onofré > jbono...@apache.org > http://blog.nanthrax.net > Talend - http://www.talend.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org > >