0

我正在尝试从 JNDI 读取定位器主机和端口信息,其值的格式为 host[port],host2[port2]。

<jee:jndi-lookup id="locatorsJndi" jndi-name="locators/locator1" />
<gfe:pool id="locatorPool" locators="#{locatorsJndi}">

在这种情况下,Spring Data gemfire 似乎无法正确识别定位器。它将 JNDI 查找值字符串作为一个主机,并在末尾附加端口 10334。

Unable to connect to any locators in the list [**host[10334],host2[10334]**:10334]; nested exception is com.gemstone.gemfire.cache.client.NoAvailableLocatorsException:

但是,如果我将主机和端口值作为定位器属性的一部分传递,如下所示,它会按预期工作。

<gfe:pool id="locatorPool" locators="host1[port1],host2[port2]">

这是 Spring Data Gemfire 中的问题吗?

4

2 回答 2

0

由于基础异常是NoAvailableLocatorsException,您能否尝试连接到定位器gfsh以查看是否成功?

gfsh>connect --locator=host1[port1]
于 2016-09-27T16:48:04.613 回答
0

无法连接到列表“ host[10334],host2[10334]:10334]”中的任何定位器;

堆栈跟踪消息中的主机/端口、逗号分隔的字符串不正确。

我收集了您在 JNDI 上下文中的 GemFire 定位器配置正确指定为...“ host[10334],host2[10334]”?

如果是这样,那么这归结为一个简单的事实,即Spring Data GemFire没有正确地,或者更确切地说,当前,处理基于 XML 命名空间元素的 bean 定义的locatorsservers属性中的SpEL 表达式。<gfe:pool>

但是,它确实处理Spring属性占位符,如...

<gfe:pool id="locatorsPool" locators="${app.gemfire.locators}"/>

要理解为什么当前行为是这样的,这是一个相当长且复杂的解释,但当然可以改进。所以,我已经提交了SGF-535

注意:我修复了在SGF-433中使用and属性PoolParser指定属性占位符时的类似问题。locatorsservers

要解决此问题,您可以执行以下操作...

<jee:jndi-lookup id="locatorsJndi" jndi-name="locators/locator1"/>

<util:properties id="applicationProperties">
  <prop key="locators">#{locatorsJndi}</prop>
</util:properties>

<context:property-placeholder properties-ref="applicationProperties"/>

<gfe:pool id="locatorPool" locators="${locators}"/>

关注SGF-535了解我的最新进展。

带来不便敬请谅解,

约翰

于 2016-09-27T20:40:19.407 回答