1 Reply Latest reply on Feb 5, 2014 11:37 AM by pires

    Blueprint CXF bundle can't find remote service in SCR bundle?

    pires

      I'm trying to build a simple demo where I have a REST CXF endpoint (UserService) that uses a remote OSGi service (BillingService). I'm using Blueprint for the CXF module DI and SCR for the OSGi service, but it seems the first doesn't deal well with latter being a Remote Service. In the same profile, everything works.

       

      I'm detailing the steps to reproduce this, hoping someone can shed some light if this is a bug or simply me being a lamme developer.

       

      1. Build and install example code:

      git clone https://github.com/pires/fabric8-cxf-dosgi-demo.git

      cd fabric8-cxf-dosgi-demo

      git branch --track user_blueprint origin/user_blueprint

      git checkout user_blueprint

      mvn clean install

       

      2. Download fabric8 [distro](https://repository.jboss.org/nexus/content/repositories/ea/io/fabric8/fabric8-karaf/1.0.0.redhat-328/fabric8-karaf-1.0.0.redhat-328.tar.gz) or build your own. I was using 336 according to perfectus build number.

       

      3. Create a new fabric ensemble (don't forget to edit etc/users.properties)

      tar zxf fabric8-karaf-1.0.0.redhat-328.tar.gz

      cd fabric8-karaf-1.0.0.redhat-328

      fabric:create --clean root

       

      4. Create a new profile named myosgiservice, with the following parent profiles:

      default

      feature-dosgi

       

      5. Add the following bundle:

      mvn:com.github.pires.example.fabric8/cxf-dosgi-demo-billing/0.1-SNAPSHOT

       

      6. Create a new profile named myrestservice ,with the following parent profiles:

      default

      feature-dosgi

      example-quickstarts-rest

       

      7. Add the following bundle:

      mvn:com.github.pires.example.fabric8/cxf-dosgi-demo-rest/0.1-SNAPSHOT

       

      8. Create a new container and assign profile mydosgiservice. It should start successfully.

       

      9. Create a new container and assign profile myrestservice. It won't start, complaining about:

      Provision Exception:

      org.osgi.service.resolver.ResolutionException: Unable to resolve dummy/0.0.0: missing requirement [dummy/0.0.0] osgi.identity; osgi.identity=com.github.pires.example.fabric8.cxf-dosgi-demo-rest; type=osgi.bundle; version="[0.1.0.SNAPSHOT,0.1.0.SNAPSHOT]" [caused by: Unable to resolve com.github.pires.example.fabric8.cxf-dosgi-demo-rest/0.1.0.SNAPSHOT: missing requirement [com.github.pires.example.fabric8.cxf-dosgi-demo-rest/0.1.0.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=com.github.pires.example.fabric8.billing)(version>=0.1.0)(!(version>=1.0.0)))"]

        at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:285)

        at org.apache.felix.resolver.Candidates.populate(Candidates.java:153)

        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:148)

        at io.fabric8.agent.DeploymentBuilder.resolve(DeploymentBuilder.java:225)

        at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:502)

        at io.fabric8.agent.DeploymentAgent$2.run(DeploymentAgent.java:249)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

        at java.util.concurrent.FutureTask.run(FutureTask.java:262)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

        at java.lang.Thread.run(Thread.java:744)

       


      Update #1 to match the branch I'm working on.