Uploaded image for project: 'Spring Data GemFire'
  1. Spring Data GemFire
  2. SGF-251

Creating and using GemFire Repositories based on the Spring Data Commons Repository abstraction does not work properly for domain objects stored in Subregions.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.4 M1 (Dijkstra)
    • GemFire + Spring using Spring Data Commons Repository abstract, GemfireRepository extension.

    Description

      When a user implements an application domain object associated with a GemFire Subregion, by way of the @Region annotation on the domain object class, along with a corresponding Repository/GemfireRepository interface extension for basic data access and query operations, Spring Data GemFire fails to properly find the Subregion bean defined in the Spring ApplicationContext, and results in the following Exception...


      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.spring.data.gemfire.cache.SubRegionRepositoryTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.spring.data.gemfire.app.dao.repo.ProgrammerRepository org.spring.data.gemfire.cache.SubRegionRepositoryTest.programmersRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'programmerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No region '/Users/Programmers' found for domain class class org.spring.data.gemfire.app.beans.Programmer! Make sure you have configured a Gemfire region of that name in your application context!
      	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:376)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.spring.data.gemfire.app.dao.repo.ProgrammerRepository org.spring.data.gemfire.cache.SubRegionRepositoryTest.programmersRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'programmerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No region '/Users/Programmers' found for domain class class org.spring.data.gemfire.app.beans.Programmer! Make sure you have configured a Gemfire region of that name in your application context!
      	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)
      	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
      	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
      	... 29 more
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'programmerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No region '/Users/Programmers' found for domain class class org.spring.data.gemfire.app.beans.Programmer! Make sure you have configured a Gemfire region of that name in your application context!
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1468)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
      	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)
      	... 31 more
      Caused by: java.lang.IllegalStateException: No region '/Users/Programmers' found for domain class class org.spring.data.gemfire.app.beans.Programmer! Make sure you have configured a Gemfire region of that name in your application context!
      	at org.springframework.data.gemfire.repository.support.GemfireRepositoryFactory.getTemplate(GemfireRepositoryFactory.java:111)
      	at org.springframework.data.gemfire.repository.support.GemfireRepositoryFactory.getTargetRepository(GemfireRepositoryFactory.java:98)
      	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:136)
      	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
      	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
      	... 39 more
      

      Attachments

        Activity

          People

            jblum John Blum
            jblum John Blum
            Trevor Marshall Trevor Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 4d
                4d
                Remaining:
                Time Spent - 1.5d Remaining Estimate - 0.5d
                0.5d
                Logged:
                Time Spent - 1.5d Remaining Estimate - 0.5d Time Not Required
                1.5d