Java小程序停止更新JRE 7u21后工作 [英] Java applet stopped working after update to JRE 7u21

查看:206
本文介绍了Java小程序停止更新JRE 7u21后工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Java小程序停止工作,一旦JRE更新到7u21。

My java applet stopped working once JRE was updated to 7u21.

简短的摘要:


  • 我得到的例外是:netscape.javascript.JSException和结果
    java.lang.NoClassDefFoundError的。小应用程序工作得很好,直到JRE
    7u21。

  • The Exceptions I get are: netscape.javascript.JSException and
    java.lang.NoClassDefFoundError. the applet worked fine until JRE 7u21.

该小程序是使用Oracle的DeployJava.js嵌入在网页。

The applet is embedded in a web page using Oracle's DeployJava.js.

该小程序是通过JNI签署,它使用LiveConnect的触发事件,其访问USB和串行端口,它使用来自多个JAR文件code。

The applet is signed, it uses LiveConnect to fire events, it access USB and serial ports through JNI, it uses code from multiple JAR files.

故障发生在测试的所有桌面浏览器(火狐,Chrome,IE8 / 9和Mac上的Safari)。

The failure happens on all desktop browsers tested (Firefox, chrome, IE8/9 and Safari on Mac).

详细内容:


  • 我有一个Java小程序,可以让我的网站上有一个USB设备进行通信。

  • I have a java applet that allows my website to communicate with a USB device.

该小程序已经在过去一年的工作很好。

The applet has been working well for the past year.

在JRE7更新21发布 - 小程序停止工作

Once JRE7 update 21 was released - the applet stopped working.

小程序在一个网页(ASP.NET)使用Oracle的DeployJava.js图书馆主办。

The applet is hosted in a web page (ASP.NET) using Oracle's DeployJava.js library.

它使用LiveConnect的引发事件回到我的javascript code。

It uses LiveConnect to raise events back to my javascript code.

我对JRE 7u21的第一个问题是在第一次尝试引发一个事件一个例外,通过LiveConnect的:

The first problem I had on JRE 7u21 was an exception on the first attempt to raise an event through LiveConnect:

netscape.javascript.JSException: JavaScript error while calling "_notify"
at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
at sun.plugin2.main.client.MessagePassingJSObject.call(Unknown Source)
at <myapplet>.fireJavascriptEvent(Unknown Source)
at <myapplet>$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.asec.easypark.applets.HomeloadingApplet.start(Unknown Source)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.start(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

为了缓解这个问题,我添加了以下行到applet的ant脚本清单部分:

in order to mitigate this problem I added the following line to 'manifest' section in the ant script for the applet:

attribute name="Trusted-Library" value="true" 

我建立使用JDK 7u21小程序,它似乎帮助:

I built the applet using JDK 7u21 and it seemed to help:

之后我开始另一个错误 - 所以我相信这个解决了,但它可能造成的一个问题

after that I started getting another error - so I believe this one was solved, but it may have caused the next problem.

第二个问题是这样的:
小程序在调用由几个JAR文件code。
在另一个JAR文件中的第一次调用code(不是小程序)失败,出现以下异常:

the second problem is this: the applet is calling code from several JAR files. on the first call to code in another JAR file (not that of the applet) fails with the following exception:

**java.lang.NoClassDefFoundError**: com/codeminders/hidapi/HIDManager
    at <PackageInSecondJar>.communication.HIDTransmitter.open(Unknown Source)
    at <PackageInSecondJar>.communication.HIDTransmitterSearcher.find(Unknown Source)
    at <PackageInSecondJar>.communication.CompositeTransmitterSearcher.find(Unknown Source)
    at <PackageInAppletJar>.communication.AppletCommunicationBroker.setupDeviceProxy(Unknown Source)
    at <PackageInAppletJar>.communication.AppletCommunicationBroker.setup(Unknown Source)
    at <PackageInAppletJar>.<TheApplet>$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at <PackageInAppletJar>.<TheApplet>.start(Unknown Source)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.start(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

我已经尝试了以下措施 - 没有成功:

I already tried the following measures - without success:


  • 添加HTTP头'缓存控制'='无缓存

  • add HTTP header 'Cache-Control' = 'no-cache'

添加HTTP头'缓存控制'='无缓存,无店铺,必重新验证

add HTTP header 'Cache-Control' = 'no-cache, no-store, must-revalidate'

使用最新的DeployJava.js从 http://java.com/js/deployJava.txt (更名为.js文件)后

use latest DeployJava.js from http://java.com/js/deployJava.txt (after renaming to .js)

该小程序已经具备了这些特点:

The applet already has these features:


  • 标记安全JNLP所有的权限

  • mark security ‘all-permissions’ in jnlp

主要JAR与证书从外部CA签署

the main JAR is signed with certificate from an external CA

小程序code是 AccessController.doPrivileged 块内部运行。

the applet code is running inside a AccessController.doPrivileged block.

我是一个java的新手,所以请不要忽视明显的解决方案...

I'm a java newbie so please don't disregard the obvious solutions...

在此先感谢您的帮助,

盖伊。

推荐答案

这是不可能设置一个小程序的属性7.0.21后它下面的版本上运行两个。

It's not possible to set the attributes of an applet to work both on versions after 7.0.21 and below it.

Trusted-Library: true

属性适用于下面7.0.21的那些导致7.0.21之后要被显示的安全对话框(和最有可能的code键被阻塞)。
如果你只把

attribute works for the ones below 7.0.21 which causes a security dialog to be displayed (and most probably your code to be blocked) after 7.0.21. If you only put

Caller-Allowable-Codebase: *.yourdomain.com

你的清单文件,它开始正常工作与7.0.21后的版本,但这次它低于7.0.21版本停止。这是一个巨大的混乱。

to your manifest file, it starts to work fine with the versions after 7.0.21 but this time it stops with the versions below 7.0.21. This is a huge mess.

不过,他们已经固定的最新版本(7.0.51)本病的行为。因此,我建议使用这两种属性(可信库来电显示Allowable- codeBase的),这将工作对Java 6和7.0.51。我不认为这是为7.0.21和7.0.45之间的那些解决方案。 (我不支持他们,我们要求我们的客户升级到7.0.51)。

However they've fixed this ill behaviour with the latest version (7.0.51). So I suggest to use both attributes (Trusted-Library and Caller-Allowable-Codebase) which will work for Java 6 and 7.0.51. I don't think there is a solution for the ones between 7.0.21 and 7.0.45. (I do not support them, we ask our clients to upgrade to 7.0.51).

https://blogs.oracle.com/java-platform-group/entry/7u45_caller_allowable_$c$cbase_and

这篇关于Java小程序停止更新JRE 7u21后工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆