I am trying read locator host and port information from JNDI whose value is in the format host[port],host2[port2].
<jee:jndi-lookup id="locatorsJndi" jndi-name="locators/locator1" />
<gfe:pool id="locatorPool" locators="#{locatorsJndi}">
It seems Spring Data gemfire unable to identify locators correctly in this case. It is taking JNDI lookuped value string as one host and is appending port 10334 at the end.
Unable to connect to any locators in the list [**host[10334],host2[10334]**:10334]; nested exception is com.gemstone.gemfire.cache.client.NoAvailableLocatorsException:
But, if i pass host and port values as part of locators attribute as below, it is working as expected.
<gfe:pool id="locatorPool" locators="host1[port1],host2[port2]">
Is this an issue in Spring Data Gemfire?.
Unable to connect to any locators in the list "
host[10334],host2[10334]:10334]
";
The host/port, comma-delimited String from the Stack Trace message is not correct.
I gather your configuration of the GemFire Locators in your JNDI context is correctly specified as... "host[10334],host2[10334]
"?
If so, then this boils down to the simple fact that Spring Data GemFire does not properly, or rather currently, handle SpEL expressions in the locators
and servers
attributes of the <gfe:pool>
XML namespace element based bean definitions.
It does, however, handle Spring property placeholders, as in...
<gfe:pool id="locatorsPool" locators="${app.gemfire.locators}"/>
It is a rather long and complex explanation to understand why the current behavior is what it is, but certainly this could be improved. So, I have filed SGF-535.
NOTE: I fixed a similar issue in the
PoolParser
when property placeholders were specified with thelocators
andservers
attributes in SGF-433.
To workaround this issue, you can do the following...
<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}"/>
Follow SGF-535 for updates on my progress.
Sorry for the inconvenience,
John