I’m currently working on integrating GridDB into my Java application using the official Java client library. However, I’m encountering an issue when attempting to establish a connection to the GridDB server.
Here’s a simplified version of my code:
import java.util.Properties;
import com.toshiba.mwcloud.gs.GridStore;
import com.toshiba.mwcloud.gs.GridStoreFactory;
public class GridDBConnectionTest {
public static void main(String[] args) {
Properties props = new Properties();
props.setProperty("notificationAddress", "239.0.0.1");
props.setProperty("notificationPort", "31999");
try {
GridStore gridstore = GridStoreFactory.getInstance().getGridStore(props);
System.out.println("Successfully connected to GridDB server.");
gridstore.close();
} catch (Exception e) {
System.err.println("Failed to connect to GridDB server: " + e.getMessage());
e.printStackTrace();
}
}
}
When running this code, I consistently receive the following error message:
Failed to connect to GridDB server: Error occurred while getting connection: [hosts=239.0.0.1:31999] Failed to connect to any of given addresses
I’ve double-checked the notificationAddress and notificationPort properties, and they match the configuration of my GridDB server. Additionally, I’ve verified that the GridDB server is up and running.
Can anyone provide insights into why this error might be occurring and suggest potential solutions to resolve it? Are there any additional configuration steps or dependencies that I might be missing?