在 Apache Felix 上安装 TornadoFX OSGi 包失败

Installing TornadoFX OSGi bundle fails on Apache Felix

我正在按照此 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 包!我使用 install tornadofx-1.7.15.jar 安装了 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 是什么以及如何将它添加到包或类路径中?

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

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

从系统包中导出
org.osgi.framework.system.packages.extra=com.sun.glass.ui

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