Search code examples
gemfirespring-data-gemfire

Can not find Gemfire Region using Spring Data


I was able to run spring-gemfire-examples-master/spring-cache project successfully. However, when I try to connect my local locator, it tells me that region1 could not be found in GemfireCache. However, I can see a connection has been setup in Pulse. My steps:

  1. Open a window command, start a locator1, start a server1,create a region1
  2. Change spring-cache...cache-context.xml in sample folder as

  3. Change cacheManager accordingly.

  4. Run sample as gradlew -q run-spring-cache

I am newbie for Gemfire.

<util:properties id="gemfire-props">
    <prop key="log-level">warning</prop>
</util:properties>
<gfe:client-cache id="client-cache"   pool-name="my-pool"></gfe:client-cache>
<gfe:pool id="my-pool" subscription-enabled="true">
 <gfe:locator host="localhost" port="10334"></gfe:locator>
</gfe:pool>
<gfe:lookup-region id="Region1" name="Region1" cache-ref="client-cache">
</gfe:lookup-region>

Solution

  • In this case, you need to use

    <gfe:client-region id="Region1" name="Region1" cache-ref="client-cache"/>
    

    lookup-region is associated with cache peers; client-region is used with client caches. Also, modify Main.java accordingly to just load cache-context.xml.