在Apache Felix上安装TornadoFX OSGi包失败

时间:2018-04-02 09:21:15

标签: osgi apache-felix tornadofx

我正在按照toturial开发基于OSGi的TornadoFX桌面应用程序。在开始编码之前,我想准备OSGi环境。为此,我安装了Apache Felix 5.6.10和所需的捆绑包。 Felix和所有必需的包正常工作,如此处所示(lb命令的输出):

 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

但是,我无法启动TornadoFX捆绑!我使用tornadofx-1.7.15.jar安装了install tornadofx-1.7.15.jar,这没关系,但是当我尝试start时,会抛出以下异常:

我在命令行上使用java -jar bin/felix.jar来启动Felix。所有感兴趣的包都在Felix根文件夹下的bundle文件夹中。另外,我试图让它在IntelliJ下工作,但这可以是一个独立的线程。

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)]

现在问题是我怎样才能让它发挥作用?我还应该事先安装其他捆绑吗?什么是com.sun.glass.ui以及如何将它添加到bundle或classpath?

1 个答案:

答案 0 :(得分:0)

此错误消息表示捆绑包no.tornado.tornadofx导入包com.sun.glass.ui,但您没有安装导出该包的捆绑包。

该软件包是作为某些JDK的一部分提供的,但OSGi默认情况下不会导出,因为它不是Java SE标准的一部分。假设您的JDK包含它,您可以通过设置启动属性从系统包导出:

org.osgi.framework.system.packages.extra=com.sun.glass.ui

您还没准确说明如何启动Felix,因此我无法提供有关如何设置此属性的具体详细信息。如果您遇到困难,请编辑问题以提供更多信息。