5 Replies Latest reply on May 7, 2012 4:45 PM by 935143

    Intermittent classNoFoundException when loading applet

      I have an applet on a PHP page deployed using deployJava.js from the Deployment Toolkit, as follows:

      <script src="https://www.java.com/js/deployJava.js"></script>
      var attributes = {codebase:'https://server/web_site/folder containing the jar',
      width:'100%', height:'100%'} ;
      var parameters = {isDemo:'', FileSet:'....this is a very long string of pipe delimited filenames...', java_arguments:'-Xmx400m'} ;
      var version = '1.6.0_10';
      deployJava.runApplet(attributes, parameters, version);

      The applet is hosted on apache on a Unix server, and the jar was created using the Eclipse IDE 'export to JAR file' functionality.
      Some of the time the applet loads as it should on a client machine, other times I get a classNotFoundException, despite the fact that I haven't changed the deployed jar in any way. This happens whether the client machine is behind a proxy or not. I'm tearing my hair out trying to troubleshoot this situation. I've raked the web and have found the suggestion that each flavour of web browser defines its own applet class loader and if a fetch across the Web by this class loader fails, a ClassNotFound exception is thrown. Contrary to this, I thought that it was the java plugin that did all the work. Nevertheless, the suggestions went on to say that the failure to fetch the applet might be related to network loading on the server, .e.g. hitting the connection limit for their server, or network path related.

      Can any one comment on 1) the true mechanism by which applets are loaded and 2) more importantly, what might be causing this intermittent failure and how to troubleshoot it.

      My job is on the line here, and I would be truly grateful for any help

        • 1. Re: Intermittent classNoFoundException when loading applet
          Moderator action: deleted your crosspost.
          • 2. Re: Intermittent classNoFoundException when loading applet
            Start with java desktop troubleshooting guide - http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html
            Enable full tracing details and read through trace file for hints (compare working/failed cases).
            Also use Wireshark or other traffic sniffer to capture request/response headers.
            Java plugin will cache or not cache resources based on http headers.

            Post your findings/logs here for further advise.

            Other details that are important:
            1) Do you see this problem on more than one system?
            2) What version of JRE do you have installed? Can you reproduce the issue with latest JRE update?
            3) is it signed or unsigned application?
            4) ClassNotFound is thrown for the same class name? How that one is loaded? Paste full stack from exception.
            5) Have you tried to convert you applet to JNLP applet? Does it still have this problem if converted to JNLP?
            6) What type of java plugin do you use? (Check whether is java control panel has "new generation plugin" enabled,
            validate that when you run applet there is "java" process as child of browser process)
            7) When problem is reproducible - did you reload the applet? had it been updated while browser is open?
            Can you reproduce problem on first try after browser restart?
            8) Can you reproduce the problem if you disable caching in java control panel?
            • 3. Re: Intermittent classNoFoundException when loading applet
              Hi igor,
              Thanks for replying.

              I'm still trying to reproduce my class not found exception, so I can post a recent full stack trace. In the mean time here's an old compact one from when I had java 6 update 23 installed:

              load: class com.radinks.dnd.DNDAppletPlus not found.
              java.lang.ClassNotFoundException: com.radinks.dnd.DNDAppletPlus
                   at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
                   at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
                   at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
                   at sun.plugin2.applet.Plugin2ClassLoader.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.net.UnknownHostException: www.nottingham.ac.uk
                   at java.net.PlainSocketImpl.connect(Unknown Source)
                   at java.net.SocksSocketImpl.connect(Unknown Source)
                   at java.net.Socket.connect(Unknown Source)
                   at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
                   at sun.net.NetworkClient.doConnect(Unknown Source)
                   at sun.net.www.http.HttpClient.openServer(Unknown Source)
                   at sun.net.www.http.HttpClient.openServer(Unknown Source)
                   at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
                   at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
                   at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
                   at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
                   at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
                   at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
                   at java.net.HttpURLConnection.getResponseCode(Unknown Source)
                   at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
                   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)
                   ... 9 more
              Exception: java.lang.ClassNotFoundException: com.radinks.dnd.DNDAppletPlus

              Its the applet itself that won't load, not a class within it.

              Trying to answer some of your points:
              1) I see the problem with more than applet. Two applets that I have written and a commercial one which is the one featured above, all with the same problem. I've seen the problem on different client machines which have had different versions of java on them, but accessing the same applets on www.nottingham.ac.uk.

              3) The commercial applet is signed and my two applets are unsigned.

              6) The new generation plugin is enabled

              Until I reproduce the problem I can't add anything more useful.
              Its dead frustrating.
              • 4. Re: Intermittent classNoFoundException when loading applet
                Caused by: java.net.UnknownHostException: www.nottingham.ac.uk
                Is this a stable host? Could you have some DNS problems? Did you ever encounter problems when you visit the site?
                Basically, I would like to blame www.nottingham.ac.uk, but I am not sure.
                • 5. Re: Intermittent classNoFoundException when loading applet
                  I think baftos is right on... Look careful on the stack track complaining about "Caused by: java.net.UnknownHostException: www.nottingham.ac.uk". Sometimes DNS can be the problem especially when running within VPN.