使用 Firefox 的 IPlanet 中的小程序(未找到类)
我有一个小程序,在本地访问(IE 和 Firefox)时可以很好地加载。
但是,当我将网页放入网络服务器(本地 IPlanet)中时,它拒绝在 Firefox 上加载(但在 IE 上仍然正常)。 我在 java 控制台中收到以下错误:
load: class XXX.localprinting.LocalPrintingApplet.class not found.
java.lang.ClassNotFoundException: XXX.localprinting.LocalPrintingApplet.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:https://XXX/test/XXX/localprinting/LocalPrintingApplet/class.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Exception: java.lang.ClassNotFoundException: XXX.localprinting.LocalPrintingApplet.class
[编辑] 通过在java控制台中启用更多跟踪,我实际上找到了根本问题:
network: Connecting http://ZZZ:443/ with proxy=DIRECT
security: Loading Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loading SSL Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loaded SSL Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loading Deployment SSL certificates from C:\Documents and Settings\ZZZ\Application Data\Sun\Java\Deployment\security\trusted.jssecerts
security: Loaded Deployment SSL certificates from C:\Documents and Settings\ZZZ\Application Data\Sun\Java\Deployment\security\trusted.jssecerts
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment session certificate store
security: Checking if SSL certificate is in Deployment permanent certificate store
network: Connecting https://ZZZ/modules/print/applet/LocalPrinting.jar with cookie "aria_user_profile={DSƌ!,!C!"ÍÔaÃæK9eä|IC¦!A:i̤!?!7æâ!A7!*E!%!'!F"ú°!4QÎ!B:N´)!'RJ6a\IS"
network: Connecting https://ZZZ/modules/print/applet/LocalPrinting.jar with proxy=DIRECT
network: Connecting http://ZZZ:443/ with proxy=DIRECT
network: Connecting https://ZZZ/modules/print/applet/LocalPrinting.jar with cookie "aria_user_profile={DSƌ!,!C!"ÍÔaÃæK9eä|IC¦!A:i̤!?!7æâ!A7!*E!%!'!F"ú°!4QÎ!B:N´)!'RJ6a\IS"
**java.io.IOException: Server returned HTTP response code: 400 for URL: https://ZZZ/modules/print/applet/LocalPrinting.jar**
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack$2.run(Unknown Source)
但是,通过使用URL https://ZZZ/modules/print/applet/LocalPrinting.jar,我可以成功下载jar。
知道什么可以解释网络服务器中的不同行为吗?
我已经研究了“找不到类”的问题,但没有找到相关的东西。
一些附加信息:
小程序使用应下载的 jar 文件。但是,我可以在日志中看到它尝试下载类文件
172.16.195.55 - - [10/Jun/2010:11:47:45 +0200] "GET /XXXX/apf/init/XXXX/localprinting/LocalPrintingApplet.class HTTP/1.1" 400 147
它在 IE/Firefox/Chrome 上本地工作(无网络服务器)
- 它在 IE/Firefox/ 上与 Tomcat 一起工作Chrome
- 它可以在 IE/Chrome 上与 Iplanet 配合使用
- 它不能在带有 Firefox 的 Iplanet 上配合使用(有或没有 HTTPS)
- (当我说 Iplanet 时,它是用于静态内容的 Iplanet,对于 J2EE 内容是 Weblogic)
HTML 代码如下Firefox 在 Firebug HTML 选项卡中给出:
<object width="0" height="0" id="eprint_printingApplet" classid="clsid:CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA">
<param value="application/x-java-applet;version=1.5" name="type">
<param value="/modules/print/applet/LocalPrinting.jar" name="archive">
<param value="xxx.localprinting.LocalPrintingApplet.class" name="code">
<param value="true" name="mayscript">
<param value="printingApplet" name="name">
<param value="pdt1.glb.XXXX.net,pdt2.glb.XXXX.net" name="host">
<param value="10244" name="port">
<param value="" name="password">
<param value="XXXX" name="unto">
<param value="APPLET" name="env.applicationLabel">
<param value="1" name="env.applicationIndex">
<param value="6X" name="env.XXXX">
<comment>
<embed width="0" height="0" env.XXXX="6X" env.applicationindex="1" env.applicationlabel="APPLET" unto="XXXX" password="" port="10244" host="pdt1.glb.XXXX.net,pdt2.glb.XXXX.net" mayscript="true" name="printingApplet" code="XXXX.localprinting.LocalPrintingApplet.class" archive="/modules/print/applet/LocalPrinting.jar" type="application/x-java-applet;version=1.5">
<noembed>No Java Runtime Environment v5.0 support for applet installed</noembed>
</comment>
I have an applet which loads nicely when accessed locally (both IE and Firefox).
However, when I put my webpage in a webserver (local IPlanet), it refuses to load on Firefox (but still fine on IE).
I get the following error in the java console:
load: class XXX.localprinting.LocalPrintingApplet.class not found.
java.lang.ClassNotFoundException: XXX.localprinting.LocalPrintingApplet.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:https://XXX/test/XXX/localprinting/LocalPrintingApplet/class.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Exception: java.lang.ClassNotFoundException: XXX.localprinting.LocalPrintingApplet.class
[EDIT]
By enabling more trace in the java console, I actually get to the root issue :
network: Connecting http://ZZZ:443/ with proxy=DIRECT
security: Loading Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loading SSL Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loaded SSL Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loading Deployment SSL certificates from C:\Documents and Settings\ZZZ\Application Data\Sun\Java\Deployment\security\trusted.jssecerts
security: Loaded Deployment SSL certificates from C:\Documents and Settings\ZZZ\Application Data\Sun\Java\Deployment\security\trusted.jssecerts
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment session certificate store
security: Checking if SSL certificate is in Deployment permanent certificate store
network: Connecting https://ZZZ/modules/print/applet/LocalPrinting.jar with cookie "aria_user_profile={DSƌ!,!C!"ÍÔaÃæK9eä|IC¦!A:i̤!?!7æâ!A7!*E!%!'!F"ú°!4QÎ!B:N´)!'RJ6a\IS"
network: Connecting https://ZZZ/modules/print/applet/LocalPrinting.jar with proxy=DIRECT
network: Connecting http://ZZZ:443/ with proxy=DIRECT
network: Connecting https://ZZZ/modules/print/applet/LocalPrinting.jar with cookie "aria_user_profile={DSƌ!,!C!"ÍÔaÃæK9eä|IC¦!A:i̤!?!7æâ!A7!*E!%!'!F"ú°!4QÎ!B:N´)!'RJ6a\IS"
**java.io.IOException: Server returned HTTP response code: 400 for URL: https://ZZZ/modules/print/applet/LocalPrinting.jar**
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack$2.run(Unknown Source)
However, by using the URL https://ZZZ/modules/print/applet/LocalPrinting.jar, I can successfully download the jar.
Any idea what could explain the different behavior in the webserver?
I researched the issue of "class not found" already but without finding something relevant.
Some additional information:
The applet uses a jar file which should be downloaded. However, I can see in the logs that it tries to download the class file
172.16.195.55 - - [10/Jun/2010:11:47:45 +0200] "GET /XXXX/apf/init/XXXX/localprinting/LocalPrintingApplet.class HTTP/1.1" 400 147
It works locally (no webserver) on IE/Firefox/Chrome
- It works with Tomcat on IE/Firefox/Chrome
- It works with Iplanet on IE/Chrome
- It does not work on Iplanet with Firefox (with or without HTTPS)
- (when I say Iplanet, it's Iplanet for static content and Weblogic for J2EE stuff)
HTML code as given by Firefox in Firebug HTML tab:
<object width="0" height="0" id="eprint_printingApplet" classid="clsid:CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA">
<param value="application/x-java-applet;version=1.5" name="type">
<param value="/modules/print/applet/LocalPrinting.jar" name="archive">
<param value="xxx.localprinting.LocalPrintingApplet.class" name="code">
<param value="true" name="mayscript">
<param value="printingApplet" name="name">
<param value="pdt1.glb.XXXX.net,pdt2.glb.XXXX.net" name="host">
<param value="10244" name="port">
<param value="" name="password">
<param value="XXXX" name="unto">
<param value="APPLET" name="env.applicationLabel">
<param value="1" name="env.applicationIndex">
<param value="6X" name="env.XXXX">
<comment>
<embed width="0" height="0" env.XXXX="6X" env.applicationindex="1" env.applicationlabel="APPLET" unto="XXXX" password="" port="10244" host="pdt1.glb.XXXX.net,pdt2.glb.XXXX.net" mayscript="true" name="printingApplet" code="XXXX.localprinting.LocalPrintingApplet.class" archive="/modules/print/applet/LocalPrinting.jar" type="application/x-java-applet;version=1.5">
<noembed>No Java Runtime Environment v5.0 support for applet installed</noembed>
</comment>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
其他一些要尝试的事情:
IE 有它自己的特性,这意味着需要两个对象标记 - 一个用于 IE,另一个用于符合标准的浏览器。有关跨浏览器对象标记的示例,请参阅此SO问题对于小程序,以及这篇文章: 揭秘 Java Applet
上面的 SO 问题还提到 FF 没有发挥作用,解决方法是重新排序对象params:
现在抓住救命稻草,但您也可以使用属性而不是
子标记,因为属性似乎使用更广泛。
最后,如果您到目前为止还没有取得任何成功,请参阅此论坛帖子最后展示了一个可以在 FF 和 IE 上运行的跨浏览器对象嵌入。
Some other things to try:
IE has it's own idiosynchrasies, which means two object tags are required - one for IE and one for the standard-compliant browsers. See this SO question for an example of a cross-browser object tag for applets, and this article: Demystifying Java Applets
The SO question above also mentions that FF wasn't playing ball, and the fix was to re-order the object params:
Clutching at straws now, but you might also use attributes rather than
<PARAM>
child tags as attributes seem to be more widely used.Finally, if you've got this far without any success, this forum post at the end shows a cross-browser object embed that works on both FF and IE.
我认为您正在尝试访问类
XXX.localprinting.LocalPrintingApplet.class
而您应该访问类XXX.localprinting.LocalPrintingApplet
(没有“.class”)I think you are trying to access the class
XXX.localprinting.LocalPrintingApplet.class
whereas you should be accessing the classXXX.localprinting.LocalPrintingApplet
(without the '.class')尝试直接从 Firefox 下载 jar 文件,看看发生了什么。另外,请确保在 Web 服务器中为 jar 文件设置正确的 MIME 类型。
Try to download the jar file directly from Firefox to see what is happening. Also, make sure that the correct MIME type is set in the web server for jar files.
该故障显然是由安全违规
java.security.AccessController.doPrivileged(Native Method)
引起的,原因很可能与以下任一方面有关:
我会检查所有与java相关的安全首选项和插件。
The failure is clearly caused by a security violation
java.security.AccessController.doPrivileged(Native Method)
It's highly likely the cause is related to either:
I would check all of your java-related security preferences and plugins.