I have an applet in a JAR. When JAR is signed - be it self-signed or with a DigiCert sertificate - I get a ClassNotFoundException
on the main applet class.
When I don't sign the applet, it loads just fine - (not counting the expected SecurityException
due to the code not being signed).
But I can unpack the signed JAR and find everything to be where it is supposed to be.
The strangest part is that up until last week the set-up worked just fine. Same main class, self-signed, same deployment mix of JS/HTML etc.
Any thoughts?
Here is the error message:
java.lang.ClassNotFoundException: com.spraklab.ilos.applet.Applet
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:195)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:690)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)
Short version: No hyphens in JAR-names!
The dramatic story: Finally! Many work-days after the problem was discovered. The applet loaded fine when not signed, bud ClassNotFoundException when signed. The answer about the switching of classloaders led me to believe that there was something I had changed in my code. So I stripped my code down to a minumum. But to avoid having to restart my browser all the time and empty the cache etc, I simply used the incognito-mode of Chrome. I rebuilt the code. And everything was fine in the end. Not! When I then tested it outside of incognito, I got the error again.
So what was the difference? An examination of the server logs showed that the Jar simply wasn't being requested from the server when in regular mode! I compared my code once again against an different app with similar embed-code, and saw only one difference: I was using a hyphen in stead of an underscore in the JAR-name - which should be allowed, and which had worked fine up until about 2 weeks ago. But wasn't there also a Java update about 2 weeks ago ...?!?!