jxblum / pivotal-gemfire-clientserver-examples

Example project demonstrating Pivotal GemFire client/server application configurations using both Spring and GemFire native configuration meta-data.
15 stars 11 forks source link

spring-data-geode(gemfire) 2.0.2.RELEASE #3

Closed komushi closed 6 years ago

komushi commented 6 years ago

Regarding spring-gemfire-clientserver, thanks to your example I created a spring-boot-gemfire-server/spring-boot-geode-server based on spring-data-geode:1.0.0.INCUBATING-RELEASE.

https://github.com/komushi/spring-boot-gemfire-server https://github.com/komushi/spring-boot-geode-server

Recently I tried to upgrade spring-data-geode to 2.0.2.RELEASE but met errors during startup. Any hints will be appreciated.

The code about CacheServerFactoryBean:

@Bean
CacheServerFactoryBean geodeCacheServer (Cache gemfireCache) {

    CacheServerFactoryBean geodeCacheServer = new CacheServerFactoryBean();

    geodeCacheServer.setCache(gemfireCache);
    geodeCacheServer.setAutoStartup(properties.getAutoStartup());
    geodeCacheServer.setBindAddress("0.0.0.0");
    geodeCacheServer.setMaxConnections(properties.getMaxConnections());

    return geodeCacheServer;
}

The error log:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'geodeCacheServer' defined in class path resource [io/pivotal/spring/geode/GeodeCacheServerConfiguration.class]: Unsatisfied dependency expressed through method 'geodeCacheServer' parameter 0: No qualifying bean of type [org.apache.geode.cache.Cache] found for dependency [org.apache.geode.cache.Cache]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.geode.cache.Cache] found for dependency [org.apache.geode.cache.Cache]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:757) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) at io.pivotal.spring.geode.BootApplication.main(BootApplication.java:10) ... 8 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.geode.cache.Cache] found for dependency [org.apache.geode.cache.Cache]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1406) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1057) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ... 27 more

jxblum commented 6 years ago

Hi Komushi-

Sorry, I have not updated this repo in awhile. I will have a look into the problem and update the repo with the appropriate changes to fix the issue(s). The problem from your Stack Trace is actually fairly simple to fix.

Stay tuned, -j

jxblum commented 6 years ago

Alright, I have just checked in changes (see commit [6033aa0|https://github.com/jxblum/pivotal-gemfire-clientserver-examples/commit/6033aa07939175687ecf5bb3fc498b67b8a965ce] and commit [8bdfaa7|https://github.com/jxblum/pivotal-gemfire-clientserver-examples/commit/8bdfaa7deb7c0e416f0144143bc32be3a0d87d0f] for more details.

All 4 Pivotal GemFire [with Spring Data GemFire) client/server examples now run for me.