在Web Start上启动胶子应用程序的例外情况

时间:2016-05-16 14:43:53

标签: java security applet gluon gluon-desktop

当通过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文件进行另一次更改。

1 个答案:

答案 0 :(得分:0)

没错,Java 8引入了一些关于JavaFX的更改(我真的认为这些更改是在稍后的更新中,但这不是重点)..今天某种程度上JavaFX应用程序可以&#39; t的行为类似于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"/>

所以&#34; applet-desc&#34;标签被删除并替换为&#34; application-desc&#34;标签和&#34;安全&#34;应该使用tag来允许应用程序访问文件系统以及网络通信。 如果是这种情况(需要所有权限),则必须签署所有罐子。 问候