I want to start a Pivotal GemFire Server, Locator and client in a single JVM with Spring Boot.
The server and Locator start OK (I used "start-locator" in server gemfire.properties
).
However, when I tried to start the client connected to the locator, I got an exception:
java.lang.IllegalStateException: A connection to a distributed system already exists in this VM.
at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.validateSameProperties(InternalDistributedSystem.java:3054)
at com.gemstone.gemfire.distributed.DistributedSystem.connect(DistributedSystem.java:1642)
And, in the Exception, the existing properties that server used to connect to the Locator is printed out.
Here is the code at client:
@Bean(name = "GemfireClientProperties")
Properties gemfireClientProperties() {
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
gemfireProperties.setProperty("log-level", "config");
return gemfireProperties;
}
@Bean(name = "GemfireClientPool")
PoolFactoryBean gemfireClientPool() {
PoolFactoryBean gemfirePool = new PoolFactoryBean();
gemfirePool.setRetryAttempts(1);
gemfirePool.setLocators(Collections.singletonList(new ConnectionEndpoint("localhost", 17202)));
return gemfirePool;
}
@Bean(name = "clientCache")
ClientCache clientCache(@Qualifier("GemfireClientProperties") Properties gemfireClientProperties) {
ClientCacheFactory clientCacheFactory = new ClientCacheFactory(gemfireClientProperties);
return clientCacheFactory.create();
}
Pivotal GemFire version is 8.2.5.
I traced in debug mode, the exception is thrown at the clientCacheFactory.create() line, and in the method, the properties file passed in is correct, which has only 2 entries.
Does Pivotal GemFire have some limitation such that I cannot connect this way?