Hello,
I'm new to osgi world (coming from a JEE bck) and trying to use pax-cdi at
first to manage injection.
I have 3 bundles
Bundle A declares an interface:
/package com.eg;
public interface Itf {
        public void PrintITf();

}/

with Manifest generation using maven:
<Export-Package>com.eg*</Export-Package>


Bundle B implements this interface:
/package com.eg.impl;
public class ItfImpl implements Itf {

        public void PrintIFy() {
                System.out.println("Hello");
        }
}/

<Import-Package>
com.eg*,*
</Import-Package>

Bundle C is trying to inject Itf (as it can be done using JEE):
/@Inject
        private Itf itf;
        public void setItf(Itf itf) {
                this.itf= itf;
        }
        
        public Use() {
                itf.PrintIFy();
        }/
<Import-Package>
com.eg*, com.eg.impl*, *
</Import-Package>
<Require-Capability>
osgi.extender;
filter:="(osgi.extender=pax.cdi)",
org.ops4j.pax.cdi.extension;
filter:="(extension=pax-cdi-extension)"
</Require-Capability>

It doesn't seem to work as I always get NullPointerException starting bundle
C.

is this a classical use case in OSGI framework?
Do you think I should change the way I split these 3 bundles (moving
interface and implementation in the same bundle)?

I also tried with blueprint without being able to do it as well...
thanks for your help



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Multiple-bundles-dependencies-injection-pax-cdi-or-blueprint-tp4049756.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to