I restart the karaf container, getting rid of any and all bundles and packages except the karaf framework's bundles and packages with:
I check the number of packages with:
karaf@root()> exports | wc -l
807
and the number of bundles with:
karaf@root()> la | wc -l
55
and the number of user-installed (by me) bundles with:
I then try to install the "provider" bundle again with:
karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT
Bundle ID: 52
Error executing command: Error installing bundles:
Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.provider [52](R 52.0): missing requirement [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))]
and check the exported packages count again:
karaf@root()> exports | wc -l
809
After trying to install this new bundle, I see there are two more packages being exported.
They are from our project: org.wso2.carbon.book.provider.model and org.wso2.carbon.book.provider.
However, the bundles are not started. I guess the packages are available for use? That's interesting.
Let's check the imports for the "provider" bundle:
karaf@root()> imports -b 52 --no-format
org.osgi.framework [1.7.0,2.0.0) 52 org.wso2.carbon.book.provider
org.osgi.service.component [1.2.0,2.0.0) 52 org.wso2.carbon.book.provider
Let's use "diag" to assess the problem:
karaf@root()> diag
org.wso2.carbon.book.provider (52)
----------------------------------
Status: Installed
Unsatisfied Requirements:
[org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))
This is one the best article for learning OSGI in terms of both theoretical and conceptual aspect. This article helped me in creation of OSGI project from scratch. The author covers two examples one is developed on eclipse IDE using MANIFEST.MF file, which is quite older, and the other one is developed on IntelliJ using MAVEN.
The second example is close to our IGB project in terms of project structure. However, the example is somewhat bigger and it might be difficult to understand in first go. So I recommend to create simple "Hello World" project to understand the basic workflow and configurations of OSGI and then comeback to this example to know how bundles interact with each other in order to deliver end result.