-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.4.2
-
sparc
-
solaris_8
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://<web-server>:<port>/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()".
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://<web-server>:<port>/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()".
- duplicates
-
JDK-4788410 Cannot set preferences factory in web start
- Closed