If you ran into the above error while running java application for example the sample1.java provided by Grid DB, then do not skip reading this.
Let’s assume you have Grid DB installed and you want to run the sample1.java while in the gsadm shell using the command below;
java gsSample/Sample1.java 127.0.0.1 10001 myCluster admin admin
This error is attributed to the wrong configuration use in your gs_cluster.json file or Sample1.java file.
Thus, you need to understand how GridDB configuration mode setting works.
There are two type of GridDB configuration modes namely- Fixed List and Multicast Mode. These two operate differently.
For example GridDB 5.3.0 version is installed with a Fixed List mode i.e the configuration of cluster address on 127.0.0.1 and the Sample1.java is configured to use a multicast mode.
The steps to resolving this issue is thus as follows;
- Identify the configuration mode used in your gs_cluster.json file.
Make use of the following command;
sudo su gsadm cd cat conf/gs_cluster.json
If running these commands returns the same gs_cluster.json with 127.0.0.1 then you are confirmed to be on Fixed List Mode.
Thus, you will need to modify your java properties code as the above Gridstore configuration is configured for Multicast Mode instead of Fixed List Mode.
- Edit the Sample1.java file
while in the gsSample directory, you can run
and edit the GridDB properties setting to reflect for Fixed List mode as shown in code below;
Properties props = new Properties(); props.setProperty("notificationMember", "127.0.0.1:10001"); props.setProperty("clusterName", "myCluster"); props.setProperty("user", "admin"); props.setProperty("password", "admin"); GridStore store = GridStoreFactory.getInstance().getGridStore(props);
Now you can run the java application without any error.