I am developing an OSGi based TornadoFX desktop app by following this toturial. Before getting started with coding, I wanted to prepare the OSGi environment. For that, I installed Apache Felix 5.6.10 and the required bundles.
Felix and all required bundles work properly as shown in here (the output of the lb
command):
ID|State |Level|Name
0|Active | 0|System Bundle (5.6.10)|5.6.10
1|Active | 1|Apache Commons Logging (1.2.0)|1.2.0
2|Active | 1|Apache Apache HttpClient OSGi bundle (4.5.5)|4.5.5
3|Active | 1|Apache Apache HttpCore OSGi bundle (4.4.9)|4.4.9
4|Active | 1|jansi (1.16.0)|1.16.0
5|Resolved | 1|JavaFX 8 OSGi extension bundle (8.0.1)|8.0.1
7|Active | 1|JLine Bundle (3.5.1)|3.5.1
8|Active | 1|kotlin-osgi-bundle (1.2.31)|1.2.31
9|Active | 1|Apache Felix Bundle Repository (2.0.10)|2.0.10
10|Active | 1|Apache Felix Configuration Admin Service (1.8.16)|1.8.16
11|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
12|Active | 1|Apache Felix Gogo JLine Shell (1.0.10)|1.0.10
13|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
18|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
22|Active | 1|JSR 353 (JSON Processing) Default Provider (1.0.0)|1.0.0
However, I can not start the TornadoFX bundle! I installed tornadofx-1.7.15.jar
using install tornadofx-1.7.15.jar
, which was OK, but when I tried to start
it, the following exception is thrown:
I am using java -jar bin/felix.jar
on the command line to launch Felix. All the interested bundles are in the bundle
folder beneath Felix's root folder. Also, I am trying to make it work under IntelliJ, but this can be an independent thread.
org.osgi.framework.BundleException: Unable to resolve no.tornado.tornadofx [26](R 26.0):
missing requirement [no.tornado.tornadofx [26](R 26.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.glass.ui) Unresolved requirements:
[[no.tornado.tornadofx [26](R 26.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.glass.ui)]
Now the question is that how can I make it work? Is there any other bundle that I should install beforehand? what is com.sun.glass.ui
for and how to add it to the bundles or classpath?
This error message means that the bundle no.tornado.tornadofx
imports package com.sun.glass.ui
, but you do not have a bundle installed that exports that package.
That package is delivered as part of some JDKs, but OSGi does not export by default because it is not part of the Java SE standard. Assuming your JDK includes it, you can export from the system bundle by setting the launch property:
org.osgi.framework.system.packages.extra=com.sun.glass.ui
You haven't said exactly how you are launching Felix so I can't give specific details on how to set this property. If you have difficulty then edit the question to supply more information this.