JDK-6559439 : Downloading more than one resource causes "canceled by user" RuntimeException
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-05-18
  • Updated: 2011-02-16
  • Resolved: 2007-05-18
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2

EXTRA RELEVANT SYSTEM CONFIGURATION :
Loading resources listed in a JNLP file over a standard ethernet network

A DESCRIPTION OF THE PROBLEM :
While loading an application using the DownloadService, the DownloadServiceListener retrieved from 'getDefaultProgressWindow' will throw a RuntimeException with a message of 'canceled by user' when trying to download the 2nd resource using 'loadResource'. The first resource file downloads to the client without an error. JRE1.5 WebStart works fine with the same client / servers and JNLP file.

I have found others online who have complained of the same problem. Their proposed solution was to only use getDefaultProgressWindow once instead of for each resource. This does not fix the problem.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Deploy a Java application with a JNLP file listing multiple jar files. The main application is a "loader" class that loads that clears the resources out of cache (cia 'removeResource') and then manually downloads remaining jar files to the client and executes the application's main class. The load can load the first jar file to the client, but the 2nd file reports a RuntimeException stating 'canceled by user' to the Java Console and the application fails to load.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
With JRE 1.5.x (and all previous web start versions going several years back), the application loads as expected.
ACTUAL -
Unable to Load Resource: java.lang.RuntimeException: canceled by user
java.lang.RuntimeException: canceled by user
	at com.sun.jnlp.DownloadServiceImpl$DefaultProgressImpl.progress(Unknown Source)
	at com.sun.jnlp.DownloadServiceImpl$ProgressHelper.<init>(Unknown Source)
	at com.sun.jnlp.DownloadServiceImpl$5.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.jnlp.DownloadServiceImpl.loadResource(Unknown Source)
	at lt.loader.LTLoader.loadResources(LTLoader.java:150)
	at lt.loader.LTLoader.init(LTLoader.java:72)
	at lt.loader.LTLoader.main(LTLoader.java:200)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javaws.Launcher.executeApplication(Unknown Source)
	at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
	at com.sun.javaws.Launcher.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Removing Resource: http://11.17.193.156:1191/apps/hap/localTerminal/loader.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/xxx2.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/xxx3.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/xxx4.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/xxx5.jar
Removing Resource: http://11.17.193.156:1191/apps/hap/localTerminal/crimson.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/jaxp.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/jnlp.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/log4j-1.2.3.jar
Removing Resource: http://10.17.193.156:1191/apps/hap/localTerminal/xmlrpc-1.2-b1.jar
Loading Resource: http://10.17.193.156:1191/apps/hap/localTerminal/loader.jar
Loading Resource: http://10.17.193.156:1191/apps/hap/localTerminal/xxx1.jar
Unable to Load Resource: java.lang.RuntimeException: canceled by user
java.lang.RuntimeException: canceled by user
	at com.sun.jnlp.DownloadServiceImpl$DefaultProgressImpl.progress(Unknown Source)
	at com.sun.jnlp.DownloadServiceImpl$ProgressHelper.<init>(Unknown Source)
	at com.sun.jnlp.DownloadServiceImpl$5.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.jnlp.DownloadServiceImpl.loadResource(Unknown Source)
	at lt.loader.LTLoader.loadResources(LTLoader.java:150)



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
This is all I can provide:

    for (int i = 0; i < resources.size(); i++)
    {
      try
      {
        System.out.println(
            "Removing Resource: " + bs.getCodeBase() +
            (String)resources.get(i));
        ds.removeResource(new URL(bs.getCodeBase() + (String)resources.get(i)),
                          null);
      }
      catch (Exception e)
      {
        System.err.println("Unable to Remove Resource: " + e);
      }

    DowloadServiceListener dsl = ds.getDefaultProgressWindow();
    for (int i = 0; i < resources.size(); i++)
    {
      try
      {
        System.out.println(
            "Loading Resource: " + bs.getCodeBase() +
            (String)resources.get(i));
        taskOutput.setText("Loading: "+bs.getCodeBase() + (String)resources.get(i));
        ds.loadResource(new URL(bs.getCodeBase() + (String)resources.get(i)),
                        null, dsl);
      }

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I created my own progress window.

Comments
EVALUATION I came across this regression yesterday and filed 6559077, so will close this as a duplicate. I will address 6559077 in 6u3. /Andy
18-05-2007