Does anyone know the details of how sun.plugin2.applet.Applet2ClassLoader loads classes? E.g., where does it first look for a class, what are the things that can make it fail to load from that location, etc.? I ask because I'm trying to find out why it looks in the code base folder for a class that is in a jar. The weird thing is that it can load another class that is in the same jar.
The ff. is the applet tag I use:
<applet codebase="../../applets" code="my.package.MyApplet" class="invisible" id="myApplet">
<param value="value0" name="param0"/>
...
<param value="valueN" name="paramN" />
<param value="folder/myApplet__0.0.1177.jar,folder/commons-io-1.3.2__0.0.1177.jar,..." name="cache_archive"/>
<param value="0.0.1177.0,0.0.1177.0,...," name="cache_version"/>
</applet>
I have omitted a few parameter tags and I have renamed packages and folders to keep the company and project anonymous. This is the exception that I get:
Exception in thread "thread applet-my.package.MyApplet-10" java.lang.NoClassDefFoundError: another/package/SomeClass
at my.package.MyApplet.init(MyApplet.java:95)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: another.package.SomeClass
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 3 more
Caused by: java.io.IOException: open HTTP connection failed:https://myserver/mycontext/applets/another/package/SomeClass.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
Again, I have changed the package and class names to keep the company and the project anonymous.
You can see that another.package.SomeClass is the problematic class. It is in the same jar as my.package.MyApplet (myApplet__0.0.1177.jar). However, the latter is loaded from the jar but the former is attempted to be loaded from the code base folder of the applet (https://myserver/mycontext/applets/).
Another important thing to note is that this exception is only occasionally encountered. Sometimes the applet is initialized without a hitch. This also means that, often, when the browser is restarted, the problem goes away.