2

我正在使用 Oracle 的 deployApplet.js 库运行一个自签名小程序。(检查生成的 html,它正在使用applet标记 - 我还使用 Oracle 的部署教程中的 JNLP 文件)。

当用户看到请求访问其计算机的权限的对话框时,就会出现此问题。如果他们点击允许一切都很好。如果他们单击拒绝,我会在 Java 控制台中收到以下异常:

ExitException[ 4]java.lang.RuntimeException: exit(-1)
    at com.sun.javaws.Main.systemExit(Main.java:1316)
    at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(AppPolicy.java:283)
    at com.sun.javaws.LaunchDownload.checkSignedResourcesHelper(LaunchDownload.java:1825)
    at com.sun.javaws.LaunchDownload.checkSignedResources(LaunchDownload.java:1508)
    at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(JNLP2Manager.java:1161)
    at sun.plugin2.applet.JNLP2Manager.loadJarFiles(JNLP2Manager.java:473)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1495)
    at java.lang.Thread.run(Thread.java:680)
Exception: ExitException[ 4]java.lang.RuntimeException: exit(-1)
java.lang.NullPointerException
    at sun.plugin.util.ErrorPanel.deniedCertificateFailure(ErrorPanel.java:334)
    at sun.plugin.util.ErrorPanel.<init>(ErrorPanel.java:61)
    at sun.plugin.util.GrayBoxPanel.setError(GrayBoxPanel.java:104)
    at sun.plugin.util.GrayBoxPainter.paintGrayBox(GrayBoxPainter.java:473)
    at sun.plugin.util.GrayBoxPainter$4.run(GrayBoxPainter.java:411)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:643)
    at java.awt.EventQueue$1.run(EventQueue.java:641)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:652)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

浏览器在此之后挂起,我需要手动终止 Java Applet 进程或重新启动浏览器。根据堆栈跟踪和在我的小程序中执行一些静态初始化程序调试步骤,在引发异常之前,我的小程序中的任何代码似乎都没有被执行。

当用户点击拒绝时,有什么方法可以优雅地恢复?理想情况下,小程序和 JVM 会干净地退出,但我愿意接受任何不会让浏览器挂起的事情。

编辑:

抛出异常之前的附加日志信息:

security: Showing MacOSXTrustSiteDialog
security: User permitted app to continue without priviledges
security: User has denied the privileges to the code
security: Adding certificate in Deployment denied certificate store
security: Added certificate in Deployment denied certificate store
security: We were not granted permission, exiting
basic: exception: exit(-1).
Java Plug-in 1.6.0_31
Using JRE version 1.6.0_31-b04-415-11M3646 Java HotSpot(TM) 64-Bit Server VM
4

0 回答 0