Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring数据配置未连接到定位器?_Java_Spring_Spring Data_Gemfire_Spring Data Gemfire - Fatal编程技术网

Java Spring数据配置未连接到定位器?

Java Spring数据配置未连接到定位器?,java,spring,spring-data,gemfire,spring-data-gemfire,Java,Spring,Spring Data,Gemfire,Spring Data Gemfire,假设我的目标部署环境中已经运行了Gemfire locator和cacheserver进程。目标部署环境使用 我有一个Spring3.1MVC应用程序,它希望使用Gemfire缓存。我使用的是Spring数据Gemfire 1.2.2和Gemfire 6.6.1 因此,我在我的spring.xml <util:properties id="gemfire-props"> <prop key="log-level">${gemfire.log-level}</

假设我的目标部署环境中已经运行了Gemfire locator和cacheserver进程。目标部署环境使用

我有一个Spring3.1MVC应用程序,它希望使用Gemfire缓存。我使用的是Spring数据Gemfire 1.2.2和Gemfire 6.6.1

因此,我在我的
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>

但是当我部署到目标环境时,Gemfire bean无法创建,因为定位器进程无法连接。我错过了什么?

不看日志很难说。您的配置看起来正常。您在这些过程和locator.log中看到了哪些错误

我希望这些配置能够在应用服务器中启动定位器

这些配置不会启动定位器,只会连接到已配置的定位器。但是您在前面声明定位器已经启动。此外,在使用定位器时,mcast端口应始终为0

一个常见的问题是gemfire.jar必须都在同一版本。SDGF 1.2.2取决于gemfire 7.0。如果您使用的是gemfire 6.6.1,则需要从pom中的spring数据gemfire中排除gemfire依赖项

目标部署使用客户端-服务器拓扑


此配置用于点对点。它应该仍然可以工作,但如果您有现有的缓存服务器,您可能希望将其配置为客户端。此区域是服务器上的副本还是仅本地数据?注意,如果您只需要@Cacheable,则不需要连接到网格。独立嵌入式缓存可以正常工作。

您可以尝试配置定位器池,例如:

<gfe:pool id="locatorPool">
    <gfe:locator host="host1" port="port1"/>
    <gfe:locator host="host2" port="port2"/>
</gfe:pool>

然后将缓存链接到此池:

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


谢谢你,戴夫!mcost端口设置为0。我已将Gemfire排除在SDGF 1.2.2的加载范围之外。我确实尝试了Spring配置,它使用了预期的定位器主机名和端口,但是我仍然得到了相同的异常。Dave,如果我只是需要@Cacheable,有没有办法将Gemfire用作独立的嵌入式缓存?我的客户坚持我们只使用Gemfire作为缓存提供程序,而不使用EhCache等其他提供程序。此外,我在github()上浏览了您的Gemfire示例,并在您使用SDGF 1.2.1时返回提交。我注意到复制的cs示例有一个与复制区域id相同的客户机区域。如果它们在相同的应用程序上下文中,这不会导致问题,对吗?
<gfe:cache id="gemfireCache" pool-name="locatorPool"/>