Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6506479

Applet caching not handling URIs consistently

XMLWordPrintable

    • b52
    • 6
    • b01
    • x86
    • windows_xp

        FULL PRODUCT VERSION :
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Windows XP SP2

        A DESCRIPTION OF THE PROBLEM :
        On upgrading to 1.6.0 from 1.5 all of the applets on our website failed to load, throwing a ClassNotFoundException.

        I managed to get it working in the end - the issue is that we serve our signed JAR file from a page generated in PHP, and the presence of parameters in the URL in the ARCHIVE parameter of the APPLET tag was breaking the caching - it seems to correctly get the file from our website, but then the cache doesn't seem to be able to load the file from disc.

        Basically in my test I created a file called jar.php, which returned either the JAR file (and appropriate headers) if the parameter work=1 was passed in the URL, and nothing if it wasn't. The APPLET tag we use is like this

        <applet name='quoteline' id='quoteline' code=loader3.SunLoaderApplet.class archive='jar.php?work=1' codebase='http://devserv.throg.advfn.com:3029/&#39; width='760' height='39'> etc.

        This the trace of the relevant part:

        network: Cache entry not found [url: http://devserv.throg.advfn.com:3029/jar.php?work=1, version: null]
        network: Connecting http://devserv.throg.advfn.com:3029/jar.php?work=1 with proxy=HTTP @ /192.168.0.13:3128
        network: Connecting http://devserv.throg.advfn.com:3029/jar.php?work=1 with cookie "nav_version=2; OASISID=4562fb50837b8; lang=gb"
        network: Server http://devserv.throg.advfn.com:3029/jar.php?work=1 requesting to set-cookie with "lang=us; expires=Tue, 01-Jan-08 00:00:00 GMT; path=/"
        network: Cache entry not found [url: http://devserv.throg.advfn.com:3029/jar.php, version: null]
        network: Connecting http://devserv.throg.advfn.com:3029/jar.php with proxy=HTTP @ /192.168.0.13:3128
        network: Connecting http://devserv.throg.advfn.com:3029/jar.php with cookie "nav_version=2; OASISID=4562fb50837b8; lang=us"
        network: Downloading resource: http://devserv.throg.advfn.com:3029/jar.php
        Content-Length: -1
        Content-Encoding: null
        network: Cache entry not found [url: http://devserv.throg.advfn.com:3029/loader3/SunLoaderApplet.class, version: null]
        network: Connecting http://devserv.throg.advfn.com:3029/loader3/SunLoaderApplet.class with proxy=HTTP @ /192.168.0.13:3128
        network: Connecting http://devserv.throg.advfn.com:3029/loader3/SunLoaderApplet.class with cookie "nav_version=2; OASISID=4562fb50837b8; lang=us"
        network: Cache entry not found [url: http://devserv.throg.advfn.com:3029/loader3/SunLoaderApplet/class.class, version: null]
        network: Connecting http://devserv.throg.advfn.com:3029/loader3/SunLoaderApplet/class.class with proxy=HTTP @ /192.168.0.13:3128
        network: Connecting http://devserv.throg.advfn.com:3029/loader3/SunLoaderApplet/class.class with cookie "nav_version=2; OASISID=4562fb50837b8; lang=us"
        load: class loader3.SunLoaderApplet.class not found.
        java.lang.ClassNotFoundException: loader3.SunLoaderApplet.class
        at sun.applet.AppletClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.applet.AppletClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.applet.AppletClassLoader.loadCode(Unknown Source)
        at sun.applet.AppletPanel.createApplet(Unknown Source)
        at sun.plugin.AppletViewer.createApplet(Unknown Source)
        at sun.applet.AppletPanel.runLoader(Unknown Source)
        at sun.applet.AppletPanel.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        Caused by: java.io.IOException: open HTTP connection failed.
        at sun.applet.AppletClassLoader.getBytes(Unknown Source)
        at sun.applet.AppletClassLoader.access$100(Unknown Source)
        at sun.applet.AppletClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        ... 10 more
        basic: Exception: java.lang.ClassNotFoundException: loader3.SunLoaderApplet.class
        Dump classloader list ...
            codebase=http://devserv.throg.advfn.com:3029/, key=http://devserv.throg.advfn.com:3029/,jar.php?work=1, zombie=false, cache=true, refcount=1, info=sun.plugin.ClassLoaderInfo@10064a4
        Done.

        As you can see the second part of the cache output is missing the trailing "?work=1" parameter.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a file called tmp.php in your webserver's root which has the following contents:

        <?
            global $DOCUMENT_ROOT, $work;
            
            //$f = fopen("tmp.log", "a");
            //fwrite($f, "work = $work\n");
            //fclose($f);
            
            if ($work != "1")
                exit;

            Header("Content-type: application/x-java-archive");
            Header("Content-Disposition: attachment; filename=Test.class");

            readfile($DOCUMENT_ROOT . "/Test.class");

        ?>

        and points at Test.class (replace with any applet) and a webpage with the following APPLET tag

        <applet name='test' code=Test.class archive='jar.php?work=1' width='760' height='39'></applet>


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The applet should display correctly.
        ACTUAL -
        Applet fails to load with exception given above.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        Change the location where we're serving the JAR file from so it doesn't require any parameters in the URL.

        Release Regression From : 5.0u9
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

              ngthomas Thomas Ng (Inactive)
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: