[
https://issues.apache.org/jira/browse/GEODE-4146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16305696#comment-16305696
]
Kirk Lund edited comment on GEODE-4146 at 12/28/17 10:32 PM:
-------------------------------------------------------------
Creating Connection and then creating Mapping results in two
jdbc:connector-service elements when it should keep updating a single
jdbc:connector-service element:
{noformat}
<cache xmlns="http://geode.apache.org/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" copy-on-read="
false" is-server="false" lock-lease="120" lock-timeout="60"
search-timeout="300" version="1.0" xsi:schemaLocation="http://
geode.apache.org/schema/cache
http://geode.apache.org/schema/cache/cache-1.0.xsd">
<jdbc:connector-service xmlns:jdbc="http://geode.apache.org/schema/jdbc">
<jdbc:connection name="connection1" parameters="" url="foo.bar"/>
</jdbc:connector-service>
<jdbc:connector-service xmlns:jdbc="http://geode.apache.org/schema/jdbc">
<jdbc:connection name="connection1" parameters="" url="foo.bar"/>
<jdbc:region-mapping connection-name="connection1"
primary-key-in-value="true" region="region1"/>
</jdbc:connector-service>
</cache>
{noformat}
was (Author: klund):
It looks like when CreateMappingCommand persists cluster config, the XPath
tries to match to full XmlEntity of the new jdbc:connector-service instead of
just the root element of jdbc:connector-service. And since the Mapping was not
previously persisted, no match is found so it creates a whole new second
jdbc:connector-service element containing the previously saved Connection and
the new Mapping.
{noformat}
<cache xmlns="http://geode.apache.org/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" copy-on-read="
false" is-server="false" lock-lease="120" lock-timeout="60"
search-timeout="300" version="1.0" xsi:schemaLocation="http://
geode.apache.org/schema/cache
http://geode.apache.org/schema/cache/cache-1.0.xsd">
<jdbc:connector-service xmlns:jdbc="http://geode.apache.org/schema/jdbc">
<jdbc:connection name="connection1" parameters="" url="foo.bar"/>
</jdbc:connector-service>
<jdbc:connector-service xmlns:jdbc="http://geode.apache.org/schema/jdbc">
<jdbc:connection name="connection1" parameters="" url="foo.bar"/>
<jdbc:region-mapping connection-name="connection1"
primary-key-in-value="true" region="region1"/>
</jdbc:connector-service>
</cache>
{noformat}
> geode-connectors restarting server in gfsh throws exception with jdbc mapping
> config
> ------------------------------------------------------------------------------------
>
> Key: GEODE-4146
> URL: https://issues.apache.org/jira/browse/GEODE-4146
> Project: Geode
> Issue Type: Bug
> Components: regions
> Reporter: Anilkumar Gingade
> Assignee: Kirk Lund
> Fix For: 1.4.0
>
>
> Restarting a server with previously configured jdbc connection and region
> mapping throws exception and exits the server start.
> Exception with jdbc config:
> Exception in thread "main" org.apache.geode.InternalGemFireException:
> org.apache.geode.connectors.jdbc.internal.ConnectionConfigExistsException:
> {noformat}
> ConnectionConfiguration derbyDB exists
> at
> org.apache.geode.connectors.jdbc.internal.xml.JdbcServiceConfiguration.createConnectionConfig(JdbcServiceConfiguration.java:69)
> at
> org.apache.geode.connectors.jdbc.internal.xml.JdbcServiceConfiguration.lambda$onCreate$0(JdbcServiceConfiguration.java:60)
> {noformat}
> Exception with Region Mapping:
> {noformat}
> The Cache Server process terminated unexpectedly with exit status 1. Please
> refer to the log file in /Users/agingade/gem/gemfire/s1 for full details.
> Exception in thread "main" org.apache.geode.InternalGemFireException:
> org.apache.geode.connectors.jdbc.internal.RegionMappingExistsException:
> RegionMapping for region employee exists
> at
> org.apache.geode.connectors.jdbc.internal.xml.JdbcServiceConfiguration.createRegionMapping(JdbcServiceConfiguration.java:78)
> at
> org.apache.geode.connectors.jdbc.internal.xml.JdbcServiceConfiguration.lambda$onCreate$1(JdbcServiceConfiguration.java:61)
> at java.util.ArrayList.forEach(ArrayList.java:1249)
> at
> org.apache.geode.connectors.jdbc.internal.xml.JdbcServiceConfiguration.onCreate(JdbcServiceConfiguration.java:61)
> at
> org.apache.geode.internal.cache.extension.SimpleExtensionPoint.fireCreate(SimpleExtensionPoint.java:83)
> at
> org.apache.geode.internal.cache.xmlcache.CacheCreation.create(CacheCreation.java:557)
> at
> org.apache.geode.internal.cache.xmlcache.CacheXmlParser.create(CacheXmlParser.java:338)
> at
> org.apache.geode.internal.cache.GemFireCacheImpl.loadCacheXml(GemFireCacheImpl.java:4318)
> at
> org.apache.geode.internal.cache.ClusterConfigurationLoader.applyClusterXmlConfiguration(ClusterConfigurationLoader.java:141)
> at
> org.apache.geode.internal.cache.GemFireCacheImpl.initialize(GemFireCacheImpl.java:1206)
> at
> org.apache.geode.internal.cache.GemFireCacheImpl.basicCreate(GemFireCacheImpl.java:778)
> at
> org.apache.geode.internal.cache.GemFireCacheImpl.create(GemFireCacheImpl.java:764)
> at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:175)
> at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:222)
> at
> org.apache.geode.distributed.internal.DefaultServerLauncherCacheProvider.createCache(DefaultServerLauncherCacheProvider.java:52)
> at
> org.apache.geode.distributed.ServerLauncher.createCache(ServerLauncher.java:844)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)