我有一个小程序,在本地访问时(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。
知道什么可以解释网络服务器中的不同行为吗?
我研究过“未找到课程”的问题,但没有找到相关内容。
其他一些信息:
applet使用应该下载的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
< / LI>它适用于IE / Firefox / Chrome
Firefox在Firebug HTML标签中给出的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>
答案 0 :(得分:1)
其他一些尝试:
IE拥有它自己的idiosynchrasies,这意味着需要两个对象标签 - 一个用于IE,一个用于符合标准的浏览器。有关applet的跨浏览器对象标记的示例,请参阅此SO question,以及本文:Demystifying Java Applets
上面提出的问题也提到FF没有打球,而且解决方法是重新命令对象参数:
applet name="XYZ" archive="xxx.jar" code="x.y.Applet" width='100%' height='100%' mayscript="mayscript"
现在抓住吸管,但你也可以使用属性而不是<PARAM>
子标签,因为属性似乎被更广泛地使用。
最后,如果你没有取得任何成功,那么最后这个forum post显示了一个嵌入式浏览器对象,可以在FF和IE上运行。
答案 1 :(得分:0)
我认为您正在尝试访问班级XXX.localprinting.LocalPrintingApplet.class
,而您应该访问班级XXX.localprinting.LocalPrintingApplet
(没有“.class”)
答案 2 :(得分:0)
尝试直接从Firefox下载jar文件,看看发生了什么。另外,请确保在jar文件的Web服务器中设置了正确的MIME类型。
答案 3 :(得分:0)
失败显然是由安全违规导致java.security.AccessController.doPrivileged(Native Method)
原因很可能与:
有关我会检查所有与java相关的安全首选项和插件。