This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234894 - Surefire - Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002
Summary: Surefire - Could not open/create prefs root node Software\JavaSoft\Prefs at r...
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Options&Settings (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-23 15:54 UTC by arittner
Modified: 2013-12-18 10:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (594.77 KB, text/plain)
2013-08-23 15:54 UTC, arittner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description arittner 2013-08-23 15:54:14 UTC
I've created a default maven netbeans application and the build fails with activated tests. 

I get this error message:

-------------------------------------------------------------------------------
Test set: de.sepix.demo.app.brdemo.ApplicationTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.107 sec <<< FAILURE!
testApplication(de.sepix.demo.app.brdemo.ApplicationTest)  Time elapsed: 0.011 sec  <<< FAILURE!
junit.framework.AssertionFailedError: NbModuleSuite has been started with failOnMessage(WARNING) and failOnException(INFO). The following failures have been captured:
[java.util.prefs] THREAD: main MSG: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

	at org.netbeans.junit.internal.NbModuleLogHandler.checkFailures(NbModuleLogHandler.java:218)
	at org.netbeans.junit.NbModuleSuite$NbTestSuiteLogCheck.runTest(NbModuleSuite.java:1604)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.netbeans.junit.NbModuleSuite$S.runInRuntimeContainer(NbModuleSuite.java:944)
	at org.netbeans.junit.NbModuleSuite$S.access$100(NbModuleSuite.java:667)
	at org.netbeans.junit.NbModuleSuite$S$1.protect(NbModuleSuite.java:688)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at org.netbeans.junit.NbModuleSuite$S.run(NbModuleSuite.java:684)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:491)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:113)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

I've no "Prefs"-entry under LOCAL_MACHINE/Software/JavaSoft. IMHO it's an access denied error. The Prefs section is under CURRENT_USER/...


----
Product Version = NetBeans IDE Dev (Build 201308222300)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0-ea
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.0-b45
Comment 1 arittner 2013-08-23 15:54:36 UTC
Created attachment 139145 [details]
IDE log
Comment 2 arittner 2013-08-23 15:57:15 UTC
Sorry, the IDE log is not useful. Attached bei netbeans...
Comment 3 Milos Kleint 2013-08-26 05:11:35 UTC
the issue comes from executing tests for netbeans platform app (ergo platform gets executed) and the test fails because a warning is printed to the log file. reassigning to preferences for evaluation
Comment 4 Theofanis Oikonomou 2013-08-26 09:21:10 UTC
(In reply to arittner from comment #2)
> Sorry, the IDE log is not useful. Attached bei netbeans...

Log is indeed of no use. This sounds like priviledge issue in windows. Did you try running the ide as admin? Closing as incomplete for now. Could you please reopen stating exact steps to follow? Also state windows version, jdk version, netbeans version, junit version and way you invoked the tests? Thank you.
Comment 5 arittner 2013-08-26 10:30:15 UTC
I do not know why that happens, but unprivileged applications should not write to HKEY_LOCALE_MACHINE. And also my registry has no Java Prefs entry under HKEY_LOCALE_MACHINE. But something in connection with attempts Surefire there is an access to the key.

Under HKEY_CURRENT_USER the Prefs entry exists.

The NetBeans IDE is started normally, not with administrative rights. With admin rights, it shoud be no problem to write under HKEY_LOCALE_MACHINE.

But I will try again to provide a useful IDE log.
Comment 6 skygo 2013-12-06 18:45:41 UTC
Reponed as I am this issue on a fresh installed windows 8.1x64. (I'm not the initial reporter)

Some investigation:
 Seems that the newest version of JDK windows installer (starting with jdk 7_21) are no more creating LOCAL_MACHINE/Software/JavaSoft/Prefs keys in the registry.

Manually creating the keys hide the warning and make test go further.

1) Is this JDK installer "regression" wanted for security reason ? I was not able to read feedback on this point. 

2) I though that NBTestCase was creating a Memory Preference Factory for making fake pref and not altering "actual" preference. (Seems mavenized rcp test ignore this)

Regards,

Eric

FYI: Error code x5 is access denied.
Comment 7 Theofanis Oikonomou 2013-12-09 11:11:49 UTC
(In reply to skygo from comment #6)
> Reponed as I am this issue on a fresh installed windows 8.1x64. (I'm not the
> initial reporter)

1) How did you install the ide? normal user or admin?
2) how are you running the ide? normal user or admin?

Thank you
Comment 8 skygo 2013-12-09 18:30:23 UTC
(In reply to Theofanis Oikonomou from comment #7)

In both case:
User with admin privileges but not using run as administrator to run.


----- more infos
- I build netbeans from dev source and run as above. 
  No warning on Prefs keys. and a no key created
Using the dev Netbeans.
- I build simple maven RCP it raise the warning during test phase and build failed cause warning in the log.
- I build but skip test to have a complete execution of the maven RCP
build and run it show no warning.
Comment 9 Theofanis Oikonomou 2013-12-10 13:05:04 UTC
AFAICT before 7u21 if accessing LOCAL_MACHINE/Software/JavaSoft/Prefs failed you were delegated to CURRENT_USER/Software/JavaSoft/Prefs. This does not happen after 7u21. From the stacktrace it seems that this is caused by o.n.junit.internal.NbModuleLogHandler.checkFailures so reassigning for evaluation. Thank you
Comment 10 Jaroslav Tulach 2013-12-10 14:23:07 UTC
The stacktrace itself is not that important. The printed message is:

---
NbModuleSuite has been started with failOnMessage(WARNING) and failOnException(INFO). The following failures have been captured:
[java.util.prefs] THREAD: main MSG: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5
---

NbModuleLogHandler just observes for incoming messages (via Logger) and if one of them has Level.WARNING or higher it fails the test execution. If you don't want your test run to fail on warnings, just remove failOnMessage(WARNING) from the test configuration.

Why the message from "java.util.prefs" gets logged is a question for Settings, or JDK (because the logger is java.util.prefs, not NbPreferences). It is not nice to get warning messages during test runs, but if that is something JDK wants to do and cannot be prevented then OK.
Comment 11 skygo 2013-12-10 19:17:26 UTC
I'm not sure where to ask for jdk ( https://bugs.openjdk.java.net/ or http://bugs.sun.com/ ) 

A strange result comparing two platform applications (ant based vs maven based)

I take time to build a ant based platform with qa-test (using Paint template + tutorial):
Test fails on warning on prefs key.
 Building zip + extracting + run bin/paint64.exe log show warning on the Pref key.

On the mavenized platform:
 Test fails on warning on prefs key.
 Running the mavenapp164.exe in the target arear show NO warning on the Pref keys


(BTW it breaks a tutorial for windows users, maybe cool to have a note for workaround in the tutorial page, will see that during netcat tutorial review)
Comment 12 Theofanis Oikonomou 2013-12-11 10:08:09 UTC
(In reply to skygo from comment #11)
> I'm not sure where to ask for jdk ( https://bugs.openjdk.java.net/ or
> http://bugs.sun.com/ ) 

https://bugs.openjdk.java.net/ would be the place to ask. Did you try to start the test suite without failOnMessage(WARNING)? From comment 10 it seems that this would fix the problem at least until it is fixed on jdk side.
Comment 13 skygo 2013-12-11 10:40:40 UTC
Well I'm sorry, I have no account to the openjdk, it seems complicated to get the auth rights.

IMHO there are two possible workarounds:
1: 
 From comment 10
 Removing the failOnMessage(WARNING) make it pass but may hide future warning non  wanted. 

2: 
 Altering the windows hive.
 Regedit.exe (on admin) creating the following keys
 browsing to LOCAL_MACHINE/Software/JavaSoft/ 
 creating a Prefs key
Comment 14 Theofanis Oikonomou 2013-12-11 10:45:32 UTC
(In reply to skygo from comment #13)
> Well I'm sorry, I have no account to the openjdk, it seems complicated to
> get the auth rights.
> 
> IMHO there are two possible workarounds:
> 1: 
>  From comment 10
>  Removing the failOnMessage(WARNING) make it pass but may hide future
> warning non  wanted. 

true

> 
> 2: 
>  Altering the windows hive.
>  Regedit.exe (on admin) creating the following keys
>  browsing to LOCAL_MACHINE/Software/JavaSoft/ 
>  creating a Prefs key

That seems to be the advise to fix this problem from searching for the warning.
Comment 15 skygo 2013-12-11 22:13:41 UTC
I post to the open jdk Mailing List and I was kindly redirected the http://bugs.sun.com as it seems related to oracle jdk windows installer.

bug Id is 9008810 but is not yet available.

I try to be as clear as possible but reproductability need install netbeans and maven or ant rcp platform.
Comment 16 Theofanis Oikonomou 2013-12-18 10:34:13 UTC
closing this one then. Thank you for reporting