I've come back to a @SpringBootApplication
project that uses spring-geode-starter
with version 1.2.4
although the same error happens with upgrades to 1.5.6
version.
It sets up a Geode client using
@Component
@EnableClusterDefinedRegions(clientRegionShortcut=ClientRegionShortcut.PROXY)
and in order to register interest subscriptions over HTTP, also
@Configuration
@EnableGemFireHttpSession
with a bean
@Bean
public ReactiveSessionRepository<?> reactiveSessionRepository() {
return new ReactiveMapSessionRepository(new ConcurrentHashMap<>());
}
On starting the application the spring data geode client connects to the server (Geode version 1.14
) and auto copies regions
back to the client, which is great.
However, after all the region handles are copied over, there's an error with the @EnableGemFireHttpSession
which is
Error creating bean with name 'ClusteredSpringSessions' defined in class path resource [org/springframework/session/data/gemfire/config/annotation/web/http/GemFireHttpSessionConfiguration.class]
and [gemfirePool] is not resolvable as a Pool in the application context
The first info message in the logs is:
org.springframework.session.data.gemfire.config.annotation.web.http.GemFireHttpSessionConfiguration 1109 sessionRegionAttributes: Expiration is not allowed on Regions with a data management policy of PROXY
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport 277 lambda$logInfo$3: Falling back to creating Region [ClusteredSpringSessions] in Cache [Web]
So the client is trying to create a region ClusteredSpringSessions
but it can't. The problem appears to resolve itself if I define a connection pool for HTTP, with a pool connection bean
like this
@Configuration
@EnableGemFireHttpSession(poolName="devPool")
public class SessionConfig {
@Bean
public ReactiveSessionRepository<?> reactiveSessionRepository() {
return new ReactiveMapSessionRepository(new ConcurrentHashMap<>());
}
@Bean("devPool")
PoolFactoryBean sessionPool() {
PoolFactoryBean pool = new PoolFactoryBean();
ConnectionEndpoint ce = new ConnectionEndpoint("1.2.3.4", 10334);
pool.setSubscriptionEnabled(true);
pool.addLocators(ce);
return pool;
}
}
There is still the Expiration is not allowed on Regions with a data management policy of PROXY
info message in the log, but this time the Falling back to creating Region [ClusteredSpringSessions] in Cache [Web]
appears to work.
I don't understand why a default pool can't connect.
If a pool is defined then in version 1.2.4
that can cause this issue.