-1

通过 webstart 启动 Gluon 应用程序时出现以下异常...我知道这与 GLUON 粒子没有直接关系... jar 标志似乎更多问题。例外:

java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at com.gluonhq.particle.application.Particle.<init>(Particle.java:170)
at com.gluonhq.particle.application.ParticleApplication.<init>(ParticleApplication.java:89)
at mx.gob.scjn.inventario.InventarioAJ.<init>(InventarioAJ.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Toolkit not initialized
    at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(Unknown Source)
    at javafx.scene.control.Control.<clinit>(Unknown Source)
... 28 more

我已经使用以下方法创建了我的证书:

keytool -genkey -keyalg rsa -alias CLS -keystore mykeyStorte

然后导出它:

keytool -export -alias CLS -file rsatest.cer -keystore mykeyStore

我导入到 java 控制面板并使用以下命令对 jar 进行签名:

jarsigner -keystore mykeyStore InventarioAJ.jar CLS

显然我错过了一些东西......¿任何线索?问候在得到答案后,我得到了一个“重复的问题”标记......但正确的答案不是(如我所想)只是安全/签名部分......事实上,答案的真实和重要部分有与 Application 类不能转换为 applet 并且需要对 JNLP 文件进行另一项更改这一事实有关。

4

1 回答 1

0

没错,Java 8 在 JavaFX 上引入了一些更改(我真的认为这些更改是在以后的更新中,但这不是重点).. 不知何故,今天 JavaFX 应用程序不能像 Applet 一样,所以 JNLP 文件必须看起来就像是:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost/inventarioaj/" href="InventarioAJ.jnlp">
 <resources>
    <j2se version="1.8+" href=
       "http://java.sun.com/products/autodl/j2se"/>
    <jar href="/inventarioaj/InventarioAJ.jar" main="true" />
    <jar href="lib/controlsfx-8.40.10.jar"/>
    <jar href="lib/javax.inject-1.jar"/>
    <jar href="lib/particle-1.1.0.jar"/>
    <jar href="lib/h2-1.4.191.jar"/>
    <jar href="lib/eclipselink.jar"/>
    <jar href="lib/javax.persistence_2.1.0.v201304241213.jar"/>
    <jar href="lib/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar"/>
    <jar href="lib/org.eclipse.persistence.jpars_2.5.2.v20140319-9ad6abd.jar"/>
 </resources>
 <security>
    <all-permissions/>
 </security>
 <application-desc name="Inventario de XXXX"
 main-class="mx.xxxxx.InventarioAJ"/>

因此,“applet-desc”标签被删除并被“application-desc”标签取代,并且“security”标签应该就位以允许应用程序访问文件系统以及网络通信。如果是这种情况(需要所有权限),则必须对所有 jar 进行签名。问候

于 2016-05-17T18:43:52.483 回答