2016-11-02 96 views
0

我试图运行我的Maven的OSGi JavaFX项目,但我不断收到以下错误:org.osgi.framework.BundleException:无法解决缺少的需求osgi.wiring.package; (osgi.wiring.package = javafx.application)

org.osgi.framework.BundleException: Unable to resolve launcher [4](R 4.0): missing requirement [launcher [4](R 4.0)] osgi.wiring.package; (osgi.wiring.package=javafx.application) Unresolved requirements: [[launcher [4](R 4.0)] osgi.wiring.package; (osgi.wiring.package=javafx.application)] 
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111) 
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2117) 
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) 
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) 
    at impl.App.loadBundles(App.java:84) 
    at impl.App.initialize(App.java:60) 
    at impl.App.main(App.java:26) 

mvn clean package作品完美,我得到我生成项目罐子。

一些阅读各地已经让我this StackOverflow answer

JavaFX applications depend on packages from the JavaFX APIs, such as javafx.application and several others.

In Java 8 the javafx.* packages are provided by the base JRE. However OSGi does not automatically export every package from the JRE, simply because all JREs have a bunch of non-standard packages (e.g. com.sun.* etc) that normal application code should not have access to. Therefore OSGi only makes available the packages that are defined by the relevant JCP Specification for the version of Java that you are using. For example packages such as javax.swing, org.w3c.dom, etc.

Since JavaFX is not a standard, there is no JCP Specification for JavaFX, and OSGi does not export the javafx.* packages. However you can configure OSGi to do this for you by setting the following configuration property when you launch OSGi:

org.osgi.framework.system.packages.extra=javafx.application,...

我如何能实现上述的建议,或者我能做些什么来解决这个问题?

回答

0

在您构建框架对象的应用程序中,传入配置参数的Map。您可以使用所需的javafx软件包在地图中设置org.osgi.framework.system.packages.extra属性。

+0

谢谢你的回复。你能说明@BJ Hargrave吗? –

+0

@ Program-Me-Rev BJ给出的答案中缺少的是什么,以及我在回答你所关联问题时给出的答案?我已将你的问题标记为重复。 –

相关问题