JDK-8046020 : WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 7u60
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2014-06-04
  • Updated: 2014-06-05
  • Resolved: 2014-06-05
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]


A DESCRIPTION OF THE PROBLEM :
Request to re-open JDK-8038489 there the solution was cannot reproduce.

A standard user cannot create keys below HKEY_LOCAL_MACHINE which is tried when creating the attribute systemRoot of java.util.prefs.WindowsPreferences

ADDITIONAL REGRESSION INFORMATION: 
See JDK-8038489 for a survey of JRE installers that are not affected.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- on a fresh installation of Windows 7 install JRE 7u60
- change to standard user, i.e. not member of Aministrators group
- check both registry keys (HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs and  HKEY_CURRENT_USER\Software\JavaSoft\Prefs)  they do not exist
- run Bugs
- check again HKEY_CURRENT_USER\Software\JavaSoft\Prefs has been created

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no warning
ACTUAL -
java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

5 means ERROR_ACCESS_DENIED

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package Bugs;

import java.util.prefs.Preferences;

public class PrefsWarning {

  void findPrefs() {
    Preferences prefs = Preferences.userNodeForPackage(this.getClass());
  }

  public static void main(String[] args) {
    PrefsWarning pw = new PrefsWarning();
    pw.findPrefs();
  }

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
see JDK-8038489


Comments
again - I tried this and could not reproduce. Set up a non-admin user on windows 7 box and deleted the keys as requested above before running the test.
05-06-2014