Namphibian
Namphibian

Reputation: 12211

Apache Karaf and Apache Commons Bundles

Right so some really noob(this is my first deployment of a bundle to Karaf) questions for the Apache Karaf folks out there. I am deploying a bundle that uses a lot of the org.apache.commons.* bundles. When I deployed my bundle and then try to start it, Karaf threw a error about not finding org.apache.commons.pools for example. I did a bit of googling and ran the following:

osgi:install mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-pool

This installed the missing bundle and I hit the next one. While I understand that the required bundles are not installed into the OSGI container I have some questions that need clarification.

Hope the questions are clear enough. I am making headway with karaf just need to clarify these points.

Upvotes: 3

Views: 3271

Answers (1)

jordeu
jordeu

Reputation: 6821

Not all the Java "jars" are OSGi compatible, they need to have the OSGi bundle manifest.

I follow this steps when I need to add a dependency from the console:

  • Search the library at mvnrepository.com
  • Try to install it like this:

    install mvn:[group-id]/[artifact-id]/[version]

  • If it's not an OSGi library then I search it at SpringSource. On this repository all the bundles are OSGi, but it's normal that they have outdated versions.

  • My last option is to use the Karaf wrap deployer that let you deploy non-OSGi bundles. Check the user guide.

And about the features, a feature is just a set of bundles. Read this post for further details.

Upvotes: 11

Related Questions