0

I'm trying to convert org.pbjar.jxlayer library to an OSGi bundle, I already succeeded in that but when I try to install it in Karaf container, the container claims that there is a missing requirement needed by this bundle:

Unable to resolve 312.0: missing requirement [312.0] osgi.wiring.package; (osgi.wiring.package=com.sun.java.swing)

I also put the javax.swing in the bundle import directive but the problem persists I changed the version of JDK (1.5, 1.6, 1.7) but no luck

Can you help me please in resolving this problem.

user2075227
  • 7
  • 2
  • 4
  • I had the same problem, so I took the source code and made it into a jar myself. – Jakkra May 01 '14 at 11:07
  • Do I need to put only the above instructions in the pom.xml of every SwingX module to get it running well? I mean do the swingX projects need some other third party librairies? – user2075227 May 01 '14 at 11:35

1 Answers1

1

So your bundle tries to import the com.sun.java.swing package, and when the framework tries to resolve the bundle, it cannot find anybody exporting this package. That is what the error message is trying to tell you.

In Java 7 (I have not checked older versions) this package is part of the JRE. This means the easiest way to expose it to bundles is by having the framework export it as an "extra" package. You can configure a system property when starting your framework to do that:

-Dorg.osgi.framework.system.packages.extra=com.sun.java.swing

The other alternative you have is to embed this package inside your bundle. In that case you don't need to export it via the framework (which is convenient in case you cannot reconfigure your framework) and the import package can be removed from your bundle as well. If you end up having many bundles that need this, this is probably not that convenient or good, as you will end up with many private copies of the package (instead of everybody sharing one).

Marcel Offermans
  • 3,313
  • 1
  • 15
  • 23
  • Thank you, I already resolved it using the first approach by adding the following statement : com.sun.java.swing in the etc/config.properties of Karaf 3.0.0 – user2075227 May 03 '14 at 22:27