question

Upvotes
Accepted
154 12 17 30

Could not open windows registry node… Windows RegOpenKey(...) returned error code 2 message

When I run an OMM consumer application on Windows machine, the application prints the messages below. Please advice.

Aug 15, 2017 2:00:06 PM java.util.prefs.WindowsPreferences openKey

WARNING: Could not open windows registry node Software\JavaSoft\Prefs\com\reuter

s\rfa\_/System at root 0x80000002. Windows RegOpenKey(...) returned error code 2.

BackingStoreException during checkForLink for path: /com/reuters/rfa/_System

Aug 15, 2017 2:00:06 PM java.util.prefs.WindowsPreferences WindowsRegOpenKey1

WARNING: Trying to recreate Windows registry node Software\JavaSoft\Prefs\com\re

uters\rfa\_/System\/Event/Queue at root 0x80000002.

Aug 15, 2017 2:00:06 PM java.util.prefs.WindowsPreferences openKey

WARNING: Could not open windows registry node Software\JavaSoft\Prefs\com\reuter

s\rfa\_/System\/Event/Queue at root 0x80000002. Windows RegOpenKey(...) returned

error code 2.

BackingStoreException during checkForLink for path: /com/reuters/rfa/_System/Eve

ntQueue

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
9.5k 10 5 7

According to the given warning/error messages,RFA Java fails to read some nodes in the registry while RFA is trying to load the configuration from the registry. It is possible that Windows OS does not allow the application to access the nodes in the registry because the user running the application does not have the permission.

I suggest you use one of the following ways to protect/fix the problem:

A. Login as Administrator which is allowed to access all nodes in the registry then run the application by Administrator.

or

B. Create RFA Java configuration under the User node which the user running the application can access. The client can initialize RFA Java configuration from the file as the steps below:

1) Login as the user running the application

2) Set serverList and portNumber parameter of consConnection node in <RFAJ package>\QuickStart\quickstart.xml to be host and port of the server. For example: to connect to the server name adsserver at port 14002, the configuration is:

<node name="consConnection">
   <map>
        < entry key="connectionType" value="RSSL"/>
        < entry key="serverList" value="adsserver"/>
        < entry key="portNumber" value="14002"/>
   </map>
</node>

3) Save the file.

4) Import the file to the registry. Open cmd and go to <RFAJ package>\Tools\. Then, type the following command:

java -jar config_loader.jar -file ..\QuickStart\quickstart.xml

5)The client can see the configuration is under the User node by running config_editor.bat in <RFAJ package>\Tools\ as the example shown below:

Note:

- config_editor.bat can be used to modify the RFA configuration as well.

- the client needs to run the application to read the session named myNamespace::consSession

or

C. Modify the application to read RFA Java configuration from ConfigDb setting in the application. Hence, the application does not read RFA Java configuration from the registry; there is no error from accessing registry failure. By using this way, the client does not have to setup RFA Java configuration in the registry on every machine where he would like to run the application. Please see the example source code below:

import com.reuters.rfa.config.ConfigDb;
…
void initializeConfigDb(ConfigDb configDb)
{
 configDb.addVariable("myNamespace.Sessions.consSession.connectionList","consConnection");
 configDb.addVariable("myNamespace.Connections.consConnection.connectionType","RSSL");
 configDb.addVariable("myNamespace.Connections.consConnection.serverList","adsserver");
 configDb.addVariable("myNamespace.Connections.consConnection.portNumber","14002");
}
…
public void init()
{
  …
//Context.initialize();
 ConfigDb configDb = new ConfigDb();
 initializeConfigDb(configDb);
 Context.initialize(configDb);

 // Create a Session
 String sessionName = CommandLine.variable("session");
 //_session = Session.acquire(sessionName);
 _session = Session.acquire("myNamespace::consSession");
 …
}


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1.5k 3 5 7

Complementing Pimchaya.Wongrukun's answer:

Beware, if you take the suggested solution B, i.e. you stick to only using the User tree and not put anything in the the System tree, you may still get this message printed on stderr:

Could not open/create prefs root node Software\JavaSoft\Prefs at root 
0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

This is because of this bug in Oracle Java. It has been fixed, but only in Java 9. The good news is that if you are confident you don't have anything in System tree then you can ignore the above message. More information here.

(Bonus info: If you are not getting the above error message then it is sheer luck, AFAIU. It is then because you are on a machine that at some point has had a Java installed prior to v1.7.21 of Java runtime)

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea