Suppose I have Gemfire locator & cacheserver processes already running in my target deployment environments. The target deployment environment uses a client-server topology.
I have a Spring 3.1 MVC application which wants to use the Gemfire cache. I'm using Spring Data Gemfire 1.2.2 and Gemfire 6.6.1
So I've added the following to my spring.xml
<util:properties id="gemfire-props">
<prop key="log-level">${gemfire.log-level}</prop>
<prop key="mcast-port">${gemfire.mcast-port}</prop>
<prop key="locators">${gemfire.locators}</prop>
</util:properties>
<gfe:cache id="gemfireCache" properties-ref="gemfire-props"/>
<gfe:replicated-region id="myCacheRegion" cache-ref="gemfireCache">
<gfe:cache-listener>
<ref bean="gemfireCacheLogListener"/>
</gfe:cache-listener>
<gfe:entry-ttl timeout="${gemfire.myCacheRegion.ttl}" action="DESTROY"/>
</gfe:replicated-region>
<bean id="gemfireCacheLogListener" class="org.awong.GemfireCacheLogListener"></bean>
<bean id="cacheManager" class="org.springframework.data.gemfire.support.GemfireCacheManager"
p:cache-ref="gemfireCache">
<property name="regions">
<set>
<ref bean="myCacheRegion"/>
</set>
</property>
</bean>
Assume that the external JAR dependencies have all been defined correctly in, say, Maven. Assume also that I have a properties file loaded that defines the property values referenced above. The locators
property is defined to use the IPs and ports of the Gemfire locators that have already been started.
I believe this ought to be good enough so that I can annotate beans in my MVC application with @Cacheable
. I expect these configurations to start up a locator in the application server to connect to the Gemfire grid, add myCacheRegion
to the Gemfire cacheserver, and then the cacheManager
ought to be able to use the new cache region.
I am getting BeanCreationException
s which are caused by the failure to connect to the locator when Spring starts up:
4-Mar-2013 16:02:08.750 SEVERE org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException:
[rest of stack trace snipped out]
nested exception is com.gemstone.gemfire.GemFireConfigException: Unable to contact a Locator service. Operation either timed out or Locator does not exist.
Configured list of locators is "[hostnameOfLocator<v0>:portOfLocator]".
But when I deploy to the target environments the Gemfire beans fail to be created because the locator processes cannot connect. What am I missing?