views:

285

answers:

4

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>

A: 

I think you are trying to access the class XXX.localprinting.LocalPrintingApplet.class whereas you should be accessing the class XXX.localprinting.LocalPrintingApplet (without the '.class')

seanizer
Actually it does not change anything (and I had tried it already): class XXX.localprinting.LocalPrintingApplet not found (then it tries a second time by appending the .class).
JB Hurteaux
ok, sorry, that's what seemed obvious from the log
seanizer
A: 

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.

kgiannakakis
Hi. Good sugestions.I had already tried the URL for the jar, which downloads it successfully.I also tried replaced the relative URL with this full path and same problem.For the MIME type, how do you check that? Why would it then behave differently in IE/Chrome?
JB Hurteaux
You can use Firebug's Net panel to see the value of the content-type header. Wrong MIME types could lead to problems like the one you have. It could be that Java plug-in for Firefox refuses to load a jar with incorrect content type, while other browsers are happy with it. This is of course a wild guess - I believe though it is worth checking out.
kgiannakakis
Ok, except that I see no trace of the jar, whether in Firebug Net panel, or in HTTPWatch (IE or Firefox). I guess it's delegated to the JVM?
JB Hurteaux
Try downloading the jar (something like http://myserver/myjar.jar) to find out the MIME type used (content-type header). Have also a look in IPlanet documentation to see how MIME types are configured.
kgiannakakis
Mime type is application/java-archive.I think this is fine.Actually I updated my post with additional logs, we can now see I get a 404 on the jar request.
JB Hurteaux
+1  A: 

Some other things to try:

  • Is the LocalPrintingApplet class dependent on classes in the jar? The Applet class is loaded, as seen from the logs - is the jar also loaded? You shouldn't need to have the class external to the jar.

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:

applet name="XYZ" archive="xxx.jar" code="x.y.Applet" width='100%' height='100%' mayscript="mayscript"

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.

mdma
+1 so that you get the bounty for the time spent (ends in 2 hours).I know I have already looked at the order of parameters with no success. I still need to check on the other suggestions. Will keep you posted when/if resolved.
JB Hurteaux
Thanks for that - I hope the fixes lead you to a solution. To award the bounty the answer must have a score of 2 or be manually selected as the accepted answer.
mdma
For the record, I had no success with any of these tips. Thanks though.
JB Hurteaux
A: 

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:

  • missing or invalid SSL or applet signing certificates, or
  • cross-site scripting protection, either in java or in Firefox, or
  • A conflicting firefox plugin like NoScript, or
  • java security preferences in firefox

I would check all of your java-related security preferences and plugins.

SpliFF