1

I have successfully run the Griddb Java client on Docker cli using the following command:

$ docker run -d --network="host" griddb/griddb
$ docker run --network="host" griddb/java-client

and it is running well by returning the info as specified here. I decided to translate the same to my Java code since the output exposes the configurations used in the docker Java client and as per my code, since it is essentially the same configuration, I expect the same results because my Griddb docker container instance is running in the background. Why does the docker java client run and my code doesn't go past the connection configuration? What am I doing wrong? My Configuration Code:

 public static void main(String[] args) throws GSException {
    Properties props = new Properties();
    props.setProperty("notificationAddress", "239.0.0.1");
    props.setProperty("notificationPort", "31999");
    props.setProperty("clusterName", "dockerGridDB");
    props.setProperty("user", "admin");
    props.setProperty("password", "admin");
    GridStore store = GridStoreFactory.getInstance().getGridStore(props);
    Collection<String, Person> col = store.putCollection("PEOPLE", Person.class);
    Person person=new Person();
    person.name="shisia";
    person.age=30;
    col.put(person);
    Query<Person> query = col.query("select * where name = 'shisia'");
    RowSet<Person> rs = query.fetch(true);
    while (rs.hasNext()) {
        // Update the searched Row
        Person person1 = rs.next();
        System.out.println("Name: "+ person1.name +" Age: "+ person1.age);
    }
    store.close();
}

This is the Docker cli Grdiddb output

enter image description here

The error

Hag 28, 2023 2:42:39 WB com.toshiba.mwcloud.gs.GridStoreLogger$Connection info
INFO: Retry started (context=73ad2d6, statement=null, orgAddress=null, partition=0, statementId=0, trialCount=0)
com.toshiba.mwcloud.gs.common.GSConnectionException: [145028:JC_BAD_CONNECTION] Failed to update by notification (address=/239.0.0.1:31999, reason=Receive timed out)
    at com.toshiba.mwcloud.gs.subnet.NodeResolver.updateMasterInfo(NodeResolver.java:854)
    at com.toshiba.mwcloud.gs.subnet.NodeResolver.prepareConnectionAndClusterInfo(NodeResolver.java:558)
    at com.toshiba.mwcloud.gs.subnet.NodeResolver.getPartitionCount(NodeResolver.java:241)
    at com.toshiba.mwcloud.gs.subnet.GridStoreChannel$5.execute(GridStoreChannel.java:2277)
    at com.toshiba.mwcloud.gs.subnet.GridStoreChannel.executeStatement(GridStoreChannel.java:1847)
    at com.toshiba.mwcloud.gs.subnet.GridStoreChannel.executeResolver(GridStoreChannel.java:2084)
    at com.toshiba.mwcloud.gs.subnet.GridStoreChannel.resolvePartitionId(GridStoreChannel.java:2274)
    at com.toshiba.mwcloud.gs.subnet.SubnetGridStore.putContainer(SubnetGridStore.java:992)
    at com.toshiba.mwcloud.gs.subnet.SubnetGridStore.putCollection(SubnetGridStore.java:1049)
    at com.toshiba.mwcloud.gs.subnet.SubnetGridStore.putCollection(SubnetGridStore.java:797)
    at com.toshiba.mwcloud.gs.subnet.SubnetGridStore.putCollection(SubnetGridStore.java:100)
    at com.toshiba.mwcloud.gs.partitioned.PartStore.putCollection(PartStore.java:177)
    at org.example.Griddb_Tesr.main(Griddb_Tesr.java:37)
Caused by: java.net.SocketTimeoutException: Receive timed out
    at java.base/sun.nio.ch.DatagramChannelImpl.trustedBlockingReceive(DatagramChannelImpl.java:744)
    at java.base/sun.nio.ch.DatagramChannelImpl.blockingReceive(DatagramChannelImpl.java:673)
    at java.base/sun.nio.ch.DatagramSocketAdaptor.receive(DatagramSocketAdaptor.java:241)
    at java.base/java.net.DatagramSocket.receive(DatagramSocket.java:714)
    at com.toshiba.mwcloud.gs.subnet.NodeResolver.updateMasterInfo(NodeResolver.java:795)
... 12 more

0 Answers0