0

In a Karaf features file if I include certain bundles then Karaf stops working correctly.

How can I know what bundles I should not include in a features file? for example, if I added these bundles in the features file in Karaf on Windows, Karaf is not happy and acts strange. I assume its because Karaf already provides Java interfaces for these bundles.

<bundle>mvn:org.osgi/org.osgi.core/4.3.1</bundle>
<bundle>mvn:org.osgi/org.osgi.compendium/5.0.0</bundle>

Also is there a programmatic way to determine this?

Is there a list of bundles which I should not include?

I understand that Karaf uses pax-logging rather than those slf4j.


In more detail, my SBT project compiles a list of dependent bundles for my bundle, in my list that I get back from my code I get the org.osgi.core and org.osgi.compendium. They are dependents of my osgi bundle which is my main project. Now, the problem is, how can I know that Karaf does not want this installed as part of my features?

Phil
  • 46,436
  • 33
  • 110
  • 175

1 Answers1

1

Thou' shall not install other framework packages besides the framework ;) This is an absolut NOGO!

As Karaf already provides everything you need, in that case the Framework. So don't even think about adding the std. framework packages to your OSGi env, they are already all there.

If you want to have certain compendium packages. Make sure you Install the implementing bundle, as you already pointed out, the pax-logging bundles already provide everything needed for the osgi logging compendium services.

Same is true for Pax-Web and the OSGi HttpService packages. You'll find a lot of already pre-registered OSGi compendium services with Karaf, if you need more, install the implementation, not the spec bundle.

edit

nop programmatic or Karaf internal way can tell you about to not include those bundles. It's just something commonly known. An implementing bundle always also will bring you the needed osgi packages.

Achim Nierbeck
  • 5,265
  • 2
  • 14
  • 22
  • That's fine but how do I know which ones I should not install? I want a function, or the ability to write a function which tells me if a OSGi bundle is not allowed to be installed. – Phil Feb 10 '17 at 09:16
  • in general, no OSGi bundles should be installed. If you look at the spec, you'll need to find out which one provides an implementation. Recently we had a lot of reference implementation from the Apache Projects like Aries and Felix. But you might also find implementations from Eclipse. If unsure look at the documentation of Karaf and if it's still not clear enough, ping us on the mailinglist. – Achim Nierbeck Feb 10 '17 at 11:04
  • btw. pax-logging also includes slf4j, it's a log-framework-to-osgi-framework Wrapper kinda thing ;) – Achim Nierbeck Feb 10 '17 at 11:05