0
Caused by: org.springframework.beans.factory.BeanInitializationException: Cannot find region [record] in cache GemFireCache[id = 20255495; 
isClosing = false; isShutDownAll = false;
 closingGatewayHubsByShutdownAll = false; created = Mon Jan 23 11:45:10 EST 2017; server = false; copyOnRead = false; lockLease = 120; lockTimeout = 60]
    at org.springframework.data.gemfire.RegionLookupFactoryBean.lookupFallback(RegionLookupFactoryBean.java:72)
    at org.springframework.data.gemfire.RegionLookupFactoryBean.afterPropertiesSet(RegionLookupFactoryBean.java:59)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    ... 13 more

我的 XML 文件是:

<beans>

    ....

    <context:component-scan base-package="spring.gemfire.repository.deptemp"/>

    <gfe:client-cache id="gemfireCache" pool-name="gfPool"/>

    <!--Region for being used by the Record Bean -->
    <gfe:replicated-region id="record" cache-ref="gemfireCache"/>

    <bean id="record" class="spring.gemfire.repository.deptemp.beans.Record"/>

    <gfe:pool id="gfPool" max-connections="10" subscription-enabled="true" >  
        <gfe:locator host="localhost" port="10334"/>        
    </gfe:pool>   

    <gfe:lookup-region id="record" />  
    <gfe-data:repositories base-package="spring.gemfire.repository.deptemp.repos"/>  

</beans>
4

1 回答 1

0

阿披谢赫——

为什么你这两个...

<gfe:replicated-region id="record" cache-ref="gemfireCache"/>

和这个...

<gfe:lookup-region id="record" />

另外,你已经定义了这个......

<bean id="record" class="spring.gemfire.repository.deptemp.beans.Record"/>

id="record"根据上面定义的 XML 中 bean 定义的“顺序”,哪个(最肯定)覆盖了您的 REPLICATE Region bean 定义(也带有)。

虽然Spring首先遵循 bean 定义之间的依赖顺序,但当不存在依赖关系(显式或隐式)时,它通常会遵循声明的顺序。

既然<bean id="record" .../>来了<gfe:replicated-region id="record" ../>,那么<bean id=记录../>会覆盖<gfe:replicated-region id="record"/>bean 定义。

此外,<gfe:lookup-region>不需要,因为您没有使用 GemFire/Geode 的本机配置(例如cache.xml)或集群配置服务

此外,您正在声明 a ClientCache,因此从技术上讲可能希望 a<gfe:client-region>与 GemFire/Geode 服务器区域匹配,是吗?!

虽然您可以在客户端上创建 REPLICATE 区域(甚至是 PARTITION 区域),但您通常不会这样做,因为这些区域不是任何分布式系统或 GemFire“服务器”节点集群的一部分。

客户端区域(可以是 PROXY,甚至是 CACHING_PROXY)会将数据操作分发到服务器。此外,如果您有只有特定客户需要的数据,那么您应该创建本地区域,使用<gfe:local-region>.

我肯定会读这个,首先...

http://gemfire.docs.pivotal.io/geode/basic_config/book_intro.html

接下来是这个...

http://gemfire.docs.pivotal.io/geode/topologies_and_comm/book_intro.html

那么这个...

http://gemfire.docs.pivotal.io/geode/developing/book_intro.html

最后...

http://docs.spring.io/spring-data-gemfire/docs/current/reference/html/#bootstrap

-约翰

于 2017-01-23T18:26:06.510 回答