Results 1 to 7 of 7

Thread: how to define a GemFire index with xml

  1. #1
    Join Date
    May 2012
    Posts
    4

    Question how to define a GemFire index with xml

    I tried to define an index in the spring-cache-server.xml:
    <!-- region -->
    <gfe:partitioned-region id="MyPartitionRegion" cache-ref="cache">
    </gfe:partitioned-region>

    <!-- index -->
    <gfe:index id="myIndex" type="PRIMARY_KEY" cache-ref="cache"
    expression="testId" from="/MyPartitionRegion" />

    When I start the first server ,everything is OK.
    When I start the second or the third server ,sometimes there's nothing wrong with it,but sometimes here comes the error:

    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'myIndex': Invocation of init method failed; nested exception is com.gemstone.gemfire.cache.query.IndexNameConflict Exception: Index named ' myIndex ' already exists.
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:567)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)

    What should I do with the index...

  2. #2
    Join Date
    Oct 2004
    Location
    Berwyn, PA
    Posts
    56

    Default

    Can you post your cache config?
    David Turanski
    SpringSource Senior Software Engineer

  3. #3
    Join Date
    May 2012
    Posts
    4

    Default

    spring-cache-server.xml:

    <!-- cache -->
    <gfe:cache id="cache" properties-ref="props"
    cache-xml-location="classpath:cache-server.xml" />



    cache-server.xml:

    <!DOCTYPE cache PUBLIC
    "-//GemStone Systems, Inc.//GemFire Declarative Caching 6.6//EN"
    "http://www.gemstone.com/dtd/cache6_6.dtd">
    <cache is-server="true">
    <function-service>
    <function>
    <class-name>........</class-name>
    </function>
    <function>
    <class-name>........</class-name>
    </function>
    </function-service>
    </cache>

  4. #4
    Join Date
    Oct 2004
    Location
    Berwyn, PA
    Posts
    56

    Default

    It looks like a bug but I am unable to reproduce the problem with a simple cache configuration with 2 instances running locally on different ports. It would help to see your property settings, logs, etc.
    David Turanski
    SpringSource Senior Software Engineer

  5. #5
    Join Date
    May 2012
    Posts
    4

    Default

    I've got two servers and some regions persist to disk.
    When I start the second server after the first server has already started, it's OK.
    When I restart these servers, they recovered data from disk. So they started at the same time, and the second server failed to start.

    However now I use API to create index instead, and it works.

  6. #6
    Join Date
    Oct 2004
    Location
    Berwyn, PA
    Posts
    56

    Default

    OK. I created a JIRA for this https://jira.springsource.org/browse/SGF-94
    David Turanski
    SpringSource Senior Software Engineer

  7. #7
    Join Date
    May 2012
    Posts
    4

    Default

    Thanks~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •