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

JDK Preferences and Java WebStart inter-operability problem

    XMLWordPrintable

Details

    • sparc
    • solaris_8

    Description

      Problem Description:
      Product version: 1.4.2 and Java WebStart 1.4.2

      Short description: When application is executed using Java WebStart, the
      JRE is failing to load the Preferences Factory class (set by us as value
      of system property "java.util.prefs.PreferencesFactory") ClassNotFoundException.
       
      Full problem description:

      We are using JDK Preferences APIs with our own implementation for back-end
      storage. We have created 3 classes:

       (1) Preferences Factory class (DesktopPreferencesFactoryC) that implements
       java.util.prefs.PreferencesFactory interface.

       (2) The Preferences Implemenation class (MultiLevelPreferencesImplC) that
       is subclass of java.util.prefs.AbstractPreferences class.

       (3) We have created a small class (TestLoggingGui.java) that calls
        "Preferences.userRoot()" to access the Preferences root node. It also
       contain main() method.
       
      These 3 java files are attached to this bug. The compiled class files of these 3 classes are jarred and jar-signed (test.jar).
       
      We have created a JNLP file (TestPrefsJWS.jnlp also attached) and have set the "java.util.prefs.PreferencesFactory" system property to fully-qualified classname of our preferences factory class:

           <property name="java.util.prefs.PreferencesFactory"
        value="com.nortel.jwsTest.DesktopPreferencesFactoryC"/>

      We have installed the jar file and TestPrefsJWS.jnlp file on the web-server.
       
      When we start our application from a remote machine (Windows 2000 OS) using java webstart then when we first attempt to call Preferences API ("Preferences.userRoot()") from our application (in TestLoggingGui.java), we get ClassNotFoundException - JRE is not able to load our PreferencesFactory class. But this class is in test.jar jar file which is specified in the <href> tag of the TestPrefsJWS.jnlp file.

      It seems to me that the JDK Preferences class is attempting to load our preferences factory class using "System Class Loader". But the system class loader is not containing the downloaded jar files (in our case test.jar) in the JWS deployment and hence the Preferences is failing to find the class.
       
      Test case:

      1. Copy the java files (DesktopPreferencesFactoryC.java, MultiLevelPreferencesImplC.java and TestLoggingGui.java) in some directory.

      2. Cd to that directory

      3. Compile the files: Javac -d . *.java

      4. Create test.jar jar files: jar cvf test.jar com
       
      5. Jar sign the test.jar file: You may want to use your key-store to jar sign
      the jar file.

      6. Install the jar files (test.jar) and a JNLP file (TestPrefsJWS.jnlp - attached to this email) on the web-server in "PresideNSP/data/jwsTest" subdirectory under the web-server document root directory. From the Windows 2000 client machine, launch our example by executing "javaws <http://&lt;web-server&gt;:&lt;port&gt;/PresideNSP/data/jwsTest/TestPrefsJWS.jnlp>" from the command line. Use 1.4.2 version of javaws and jre. Also in the command replace <web-server> with the hostname of the web-server you are using and <port> with the http port number. The GUI will appear and in the text area it prints the exception that we get while calling "Preferences.userRoot()".
       

      Attachments

        Issue Links

          Activity

            People

              jjb Josh Bloch
              skvasude Sujeet Vasudevan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: