0 Replies Latest reply: Mar 5, 2013 7:52 PM by 993559 RSS

    URLClassLoader cannot download jar.pack.gz under Java Plug-in 10.13.2.20

    993559
      URLClassLoader cannot download jar.pack.gz under Java Plug-in 10.13.2.20

      Our Applet uses an URLClassLoader to fetch some resource packages which are compressed by pack200.
      We set jnlp.packEnabled=true to launch the applet and everything works fine until we upgrade to JRE7u13.

      I wrote a demo to show the problem.
      The following Exception is printed when trying to fetch the resource.

      network: Downloading resource: http://127.0.0.1:8080/test/resource.jar.pack.gz
           Content-Length: 1,160
           Content-Encoding: pack200-gzip
      java.io.IOException: Invalid jar file
           at com.sun.deploy.net.HttpDownloadHelper.download(Unknown Source)
           at com.sun.deploy.cache.Cache$4.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
           at com.sun.deploy.cache.DeployFileOutputStream.close(Unknown Source)
           at java.io.FilterOutputStream.close(Unknown Source)
           at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.close(Unknown Source)
           at java.io.BufferedInputStream.close(Unknown Source)
           at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
           at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
           at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
           at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
           at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
           at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
           at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
           at sun.misc.URLClassPath$JarLoader.getJarFile(Unknown Source)
           at sun.misc.URLClassPath$JarLoader.access$600(Unknown Source)
           at sun.misc.URLClassPath$JarLoader$1.run(Unknown Source)
           at sun.misc.URLClassPath$JarLoader$1.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.misc.URLClassPath$JarLoader.ensureOpen(Unknown Source)
           at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
           at sun.misc.URLClassPath$3.run(Unknown Source)
           at sun.misc.URLClassPath$3.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.misc.URLClassPath.getLoader(Unknown Source)
           at sun.misc.URLClassPath.getLoader(Unknown Source)
           at sun.misc.URLClassPath.getResource(Unknown Source)
           at java.net.URLClassLoader$1.run(Unknown Source)
           at java.net.URLClassLoader$1.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at java.util.ResourceBundle$Control.newBundle(Unknown Source)
           at java.util.ResourceBundle.loadBundle(Unknown Source)
           at java.util.ResourceBundle.findBundle(Unknown Source)
           at java.util.ResourceBundle.findBundle(Unknown Source)
           at java.util.ResourceBundle.findBundle(Unknown Source)
           at java.util.ResourceBundle.getBundleImpl(Unknown Source)
           at java.util.ResourceBundle.getBundle(Unknown Source)
           at com.test.ExpApplet$1.run(ExpApplet.java:32)
           at java.lang.Thread.run(Unknown Source)
      network: CleanupThread used 2 us
      network: Cache entry not found [url: http://127.0.0.1:8080/test/resource.jar, version: null]
      network: Connecting http://127.0.0.1:8080/test/resource.jar with proxy=DIRECT
      network: CleanupThread used 1 us
      network: Downloading resource: http://127.0.0.1:8080/test/resource.jar
           Content-Length: 1,771
           Content-Encoding: pack200-gzip
      java.util.MissingResourceException: Can't find bundle for base name Application, locale en_US
           at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
           at java.util.ResourceBundle.getBundleImpl(Unknown Source)
           at java.util.ResourceBundle.getBundle(Unknown Source)
           at com.test.ExpApplet$1.run(ExpApplet.java:32)
           at java.lang.Thread.run(Unknown Source)
           
      And we also found that with Java Plug-in 10.13.2.20, both JRE6 and JRE7 have this problems.
      The issue still exists with Java Plug-in 10.17.2.02
      If JRE7 is removed, the applet can work fine with Java Plug-in 1.6.0_xx


      To solve the problem, we have to set jnlp.packEnabled=false