0

Background : I have two projects, proj A and proj B. Now, in proj A i have a cache.xml file , a java bean(say customer bean), a repository class(RecordRepository). I am loading the repository class in the cache.xml

Cache.xml

</gfe:client-region>

<!--Scan for annotated GemFire Repositories-->
<gfe-data:repositories base-package="cache.repository" />

In proj B, I import the jar of proj A and then try to load the bean and the repository. My goal is to create an object of customer bean and then call the repository class to save the customer bean.

Employee emp = (Employee)facilityCacheLoader.getRegionBean();
emp.setRecordId("2001");
emp.setRecordString("record string 2002");

// update the Bean and save

RecordRepository rep = (RecordRepository)facilityCacheLoader.getRepository();
rep.save(emp);

But I am getting the following exception:

Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cache.repository.RecordRepository] is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:296) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1125) at com.rxc.cacheclient.CacheLoaderClient.main(CacheLoaderClient.java:40)

abhisekh
  • 1
  • 1

1 Answers1

0

What do you mean by?

In proj B, I import the jar of proj A and then try to load the bean and the repository.

And specifically... "I 'import' the jar of proj A"?

Effectively, proj A's JAR file must be on the classpath of the application created by proj B, assuming, of course, cache.repository.RecordRepository is the fully qualified class name (FQCN) of the Repository class defined in proj A, and which you expect to be picked up in Spring's classpath component scanning, used by SD's infrastructure to locate application-defined Repositories (such as your RecordRepository) in proj B's application, i.e. ...

<!--Scan for annotated GemFire Repositories-->
<gfe-data:repositories base-package="cache.repository" />

Perhaps you could share a GitHub project with you application code and configuration

Thanks! -John

John Blum
  • 7,381
  • 1
  • 20
  • 30
  • That is what I am doing. I am adding the Jar file of Proj A in the classpath of Project B. But, it's not picking up the RecordRepository. However, if I ADD the Proj A in Proj B then it is picking up the RecordRepository and updating the region. I am not sure but, looks like there is some problem with the jar file which is getting generated. – abhisekh Feb 07 '17 at 18:49
  • I have two projects, Proj A and Proj B. In Proj A, I have a repository interface which is extending CrudRepository, this repository interface is used to get and put data from the region. Now,in eclipse when I include Proj A in Proj B I am able to save/update data in region. However, when I create a jar of Proj A and then include that jar in classpath of Project B it is not able to put()/get() from repository , it is throwing error - org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [FacilityRepository] is defined – abhisekh Feb 28 '17 at 04:50