Geode/GemFire Cannot create gemfireCache bean error: Spring Boot v2.1.3 - GemFire starter 1.1.0.RELEASE

穿精又带淫゛_ 提交于 2020-04-30 07:19:29

问题


I'm currently using Springboot v.2.1.3 to connect to PCC w/ gemfire v9.6.1. Based on the SBDG compatibility matrix, I tried to use SBDG v1.1.0.RELEASE and I see the below issue.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quoteService' defined in file [C:\Users\madhu\Downloads\pcctest\pcctest\target\classes\com\example\pcctest\QuoteService.class]: Initialization of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.geode.cache.Region]: Failed to create Region for cache [Quotes]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache' defined in class path resource [org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.example.pcctest.PcctestApplication.main(PcctestApplication.java:15) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.geode.cache.Region]: Failed to create Region for cache [Quotes]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache' defined in class path resource [org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
    at org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration.lambda$registerRegionBeans$3(CachingDefinedRegionsConfiguration.java:322) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_191]
    at org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration.registerRegionBeans(CachingDefinedRegionsConfiguration.java:295) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration.access$100(CachingDefinedRegionsConfiguration.java:107) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration$1.postProcessBeforeInitialization(CachingDefinedRegionsConfiguration.java:285) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1754) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 14 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gemfireCache' defined in class path resource [org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:224) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1115) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveBean(DefaultListableBeanFactory.java:407) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:341) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:335) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration.lambda$registerRegionBeans$3(CachingDefinedRegionsConfiguration.java:302) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    ... 21 common frames omitted
Caused by: java.lang.AbstractMethodError: null
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.lambda$null$0(ClientCacheFactoryBean.java:118) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at java.util.ArrayList.forEach(ArrayList.java:1257) ~[na:1.8.0_191]
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.lambda$new$1(ClientCacheFactoryBean.java:117) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.lambda$applyClientCacheConfigurers$2(ClientCacheFactoryBean.java:156) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_191]
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[na:1.8.0_191]
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.applyClientCacheConfigurers(ClientCacheFactoryBean.java:156) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.applyClientCacheConfigurers(ClientCacheFactoryBean.java:142) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.applyCacheConfigurers(ClientCacheFactoryBean.java:129) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.data.gemfire.CacheFactoryBean.afterPropertiesSet(CacheFactoryBean.java:177) ~[spring-data-gemfire-2.1.5.RELEASE.jar:2.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 32 common frames omitted```

Here's my pom and config.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>pcctest</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>pcctest</name>
    <description>Demo project for Spring Boot</description>
    <dependencies>
        <dependency>
            <groupId>org.springframework.geode</groupId>
            <artifactId>spring-gemfire-starter</artifactId>
            <version>1.1.0.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-to-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-to-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
@Configuration
@EnableCachingDefinedRegions
@EnableClusterConfiguration
public class TestConfig {
}```

@SpringBootApplication
public class PcctestApplication {

    public static void main(String[] args) {
        SpringApplication.run(PcctestApplication.class, args);
    }

    @Bean
    ApplicationRunner runner(QuoteService quoteService) {

        return args -> {
            Quote quote = requestQuote(quoteService, null);
            requestQuote(quoteService, quote.getId());
            requestQuote(quoteService, 10L);
        };
    }

    private Quote requestQuote(QuoteService quoteService, Long id) {

        long startTime = System.currentTimeMillis();

        Quote quote = Optional.ofNullable(id).map(quoteService::requestQuote)
                .orElseGet(quoteService::requestRandomQuote);

        long elapsedTime = System.currentTimeMillis();

        System.out.printf("\"%1$s\"%nCache Miss [%2$s] - Elapsed Time [%3$s ms]%n", quote, quoteService.isCacheMiss(),
                (elapsedTime - startTime));

        return quote;
    }
}```

jars that get downloded

org\springframework\geode\spring-gemfire-starter\1.1.0.RELEASE\spring-gemfire-starter-1.1.0.RELEASE.jar
org\springframework\boot\spring-boot-starter\2.1.3.RELEASE\spring-boot-starter-2.1.3.RELEASE.jar
org\springframework\boot\spring-boot\2.1.3.RELEASE\spring-boot-2.1.3.RELEASE.jar
org\springframework\spring-context\5.1.5.RELEASE\spring-context-5.1.5.RELEASE.jar
org\springframework\spring-aop\5.1.5.RELEASE\spring-aop-5.1.5.RELEASE.jar
org\springframework\spring-expression\5.1.5.RELEASE\spring-expression-5.1.5.RELEASE.jar
org\springframework\boot\spring-boot-autoconfigure\2.1.3.RELEASE\spring-boot-autoconfigure-2.1.3.RELEASE.jar
org\springframework\boot\spring-boot-starter-logging\2.1.3.RELEASE\spring-boot-starter-logging-2.1.3.RELEASE.jar
ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar
ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar
org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar
javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar
org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar
org\springframework\data\spring-data-gemfire\2.1.5.RELEASE\spring-data-gemfire-2.1.5.RELEASE.jar
org\springframework\spring-context-support\5.1.5.RELEASE\spring-context-support-5.1.5.RELEASE.jar
org\springframework\spring-beans\5.1.5.RELEASE\spring-beans-5.1.5.RELEASE.jar
org\springframework\spring-tx\5.1.5.RELEASE\spring-tx-5.1.5.RELEASE.jar
org\springframework\spring-web\5.1.5.RELEASE\spring-web-5.1.5.RELEASE.jar
org\springframework\data\spring-data-commons\2.1.5.RELEASE\spring-data-commons-2.1.5.RELEASE.jar
io\pivotal\gemfire\geode-core\9.5.2\geode-core-9.5.2.jar
com\github\stephenc\findbugs\findbugs-annotations\1.3.9-1\findbugs-annotations-1.3.9-1.jar
org\jgroups\jgroups\3.6.14.Final\jgroups-3.6.14.Final.jar
commons-validator\commons-validator\1.6\commons-validator-1.6.jar
commons-beanutils\commons-beanutils\1.9.2\commons-beanutils-1.9.2.jar
commons-logging\commons-logging\1.2\commons-logging-1.2.jar
commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar
commons-digester\commons-digester\2.1\commons-digester-2.1.jar
commons-lang\commons-lang\2.6\commons-lang-2.6.jar
it\unimi\dsi\fastutil\8.1.1\fastutil-8.1.1.jar
javax\resource\javax.resource-api\1.7\javax.resource-api-1.7.jar
javax\transaction\javax.transaction-api\1.3\javax.transaction-api-1.3.jar
net\java\dev\jna\jna\4.5.2\jna-4.5.2.jar
net\sf\jopt-simple\jopt-simple\5.0.4\jopt-simple-5.0.4.jar
org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar
org\apache\logging\log4j\log4j-core\2.11.2\log4j-core-2.11.2.jar
org\apache\shiro\shiro-core\1.4.0\shiro-core-1.4.0.jar
org\apache\shiro\shiro-lang\1.4.0\shiro-lang-1.4.0.jar
org\apache\shiro\shiro-cache\1.4.0\shiro-cache-1.4.0.jar
org\apache\shiro\shiro-crypto-hash\1.4.0\shiro-crypto-hash-1.4.0.jar
org\apache\shiro\shiro-crypto-core\1.4.0\shiro-crypto-core-1.4.0.jar
org\apache\shiro\shiro-crypto-cipher\1.4.0\shiro-crypto-cipher-1.4.0.jar
org\apache\shiro\shiro-config-core\1.4.0\shiro-config-core-1.4.0.jar
org\apache\shiro\shiro-config-ogdl\1.4.0\shiro-config-ogdl-1.4.0.jar
org\apache\shiro\shiro-event\1.4.0\shiro-event-1.4.0.jar
io\github\lukehutch\fast-classpath-scanner\2.18.1\fast-classpath-scanner-2.18.1.jar
com\healthmarketscience\rmiio\rmiio\2.1.2\rmiio-2.1.2.jar
io\pivotal\gemfire\geode-common\9.5.2\geode-common-9.5.2.jar
io\pivotal\gemfire\geode-json\9.5.2\geode-json-9.5.2.jar
io\pivotal\gemfire\geode-cq\9.5.2\geode-cq-9.5.2.jar
io\pivotal\gemfire\geode-lucene\9.5.2\geode-lucene-9.5.2.jar
org\apache\lucene\lucene-analyzers-common\6.6.2\lucene-analyzers-common-6.6.2.jar
org\apache\lucene\lucene-core\6.6.2\lucene-core-6.6.2.jar
org\apache\lucene\lucene-queries\6.6.2\lucene-queries-6.6.2.jar
org\apache\lucene\lucene-analyzers-phonetic\6.6.2\lucene-analyzers-phonetic-6.6.2.jar
commons-codec\commons-codec\1.11\commons-codec-1.11.jar
org\apache\lucene\lucene-queryparser\6.6.2\lucene-queryparser-6.6.2.jar
io\pivotal\gemfire\geode-wan\9.5.2\geode-wan-9.5.2.jar
antlr\antlr\2.7.7\antlr-2.7.7.jar
org\aspectj\aspectjweaver\1.9.2\aspectjweaver-1.9.2.jar
org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar
org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar
org\springframework\geode\spring-geode\1.1.0.RELEASE\spring-geode-1.1.0.RELEASE.jar
org\springframework\spring-jcl\5.1.5.RELEASE\spring-jcl-5.1.5.RELEASE.jar
org\springframework\geode\spring-geode-autoconfigure\1.1.0.RELEASE\spring-geode-autoconfigure-1.1.0.RELEASE.jar
javax\cache\cache-api\1.1.0\cache-api-1.1.0.jar
org\springframework\shell\spring-shell\1.2.0.RELEASE\spring-shell-1.2.0.RELEASE.jar
com\google\guava\guava\17.0\guava-17.0.jar
jline\jline\2.12\jline-2.12.jar
commons-io\commons-io\2.4\commons-io-2.4.jar
com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar
com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar
com\fasterxml\jackson\core\jackson-core\2.9.8\jackson-core-2.9.8.jar
org\projectlombok\lombok\1.18.6\lombok-1.18.6.jar
org\springframework\boot\spring-boot-starter-test\2.1.3.RELEASE\spring-boot-starter-test-2.1.3.RELEASE.jar
org\springframework\boot\spring-boot-test\2.1.3.RELEASE\spring-boot-test-2.1.3.RELEASE.jar
org\springframework\boot\spring-boot-test-autoconfigure\2.1.3.RELEASE\spring-boot-test-autoconfigure-2.1.3.RELEASE.jar
com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar
net\minidev\json-smart\2.3\json-smart-2.3.jar
net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar
org\ow2\asm\asm\5.0.4\asm-5.0.4.jar
junit\junit\4.12\junit-4.12.jar
org\assertj\assertj-core\3.11.1\assertj-core-3.11.1.jar
org\mockito\mockito-core\2.23.4\mockito-core-2.23.4.jar
net\bytebuddy\byte-buddy\1.9.10\byte-buddy-1.9.10.jar
net\bytebuddy\byte-buddy-agent\1.9.10\byte-buddy-agent-1.9.10.jar
org\objenesis\objenesis\2.6\objenesis-2.6.jar
org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar
org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar
org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar
com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar
org\springframework\spring-core\5.1.5.RELEASE\spring-core-5.1.5.RELEASE.jar
org\springframework\spring-test\5.1.5.RELEASE\spring-test-5.1.5.RELEASE.jar
org\xmlunit\xmlunit-core\2.6.2\xmlunit-core-2.6.2.jar```

I've tried using all Gemfire Starter 1.1.X versions with Springboot v2.1.3 and I see similar gemfireCache bean creation issue. Can someone let me know if I'm missing anything here and help me with the compatible Gemfire starter to use with Springboot v.2.1.3 in particular?


回答1:


@Madmax- To which version compatibility matrix do you refer? This is the "official" version compatibility matrix.

As you can see, the latest version of SBDG 1.1.x is 1.1.6.RELEASE, which is based on Spring Boot 2.1.13.RELEASE.

If we go back to SBDG 1.1.0.RELEASE we see that it was based on Spring Boot 2.1.7.RELEASE. This creates a cascading effect on transitive dependencies.

Since SBDG 1.1.0.RELEASE is based on Spring Boot 2.1.7.RELEASE, that means SBDG 1.1.0.RELEASE also requires Spring Data Lovelace-SR10 (which is pulled in by Boot 2.1.7.RELEASE). Spring Data Lovelace-SR10 (here) includes Spring Data for Apache Geode and Pivotal GemFire (SDG) 2.1.10.RELEASE. Therefore, SBDG 1.1.0.RELEASE has a minimum requirement of Spring Boot 2.1.7.RELEASE and SDG 2.1.10.RELEASE.

If we repeat this exercise for Spring Boot 2.1.3.RELEASE, we see that Boot pulls in Spring Data Lovelace-SR5 (here), which includes SDG 2.1.5.RELEASE. SDG 2.1.5.RELEASE does not meet the minimum requirement for SBDG 1.1.0.RELEASE.

Note, this extends all the way down to the core Spring Framework itself, since Spring Boot is based on and pulls in the core Spring Framework as well, and Spring Data is also based on the core Spring Framework. Therefore, all the versions must align.

In general, you cannot string together incompatible versions. If the version compatibility matrix (or more technically, the SBDG gradle.properties file, for example) states a particular version of a direct or transitive dependency, then that version of the dependency is expected and required.

Having said that, I setup an example/test project with SDDG 1.1.0.RELEASE based on Spring Boot 2.1.3.RELEASE to see if I could reproduce your error. I did! However, I got a more precise error message:

Caused by: java.lang.AbstractMethodError: Receiver class org.springframework.geode.boot.autoconfigure.CacheNameAutoConfiguration$$Lambda$327/0x0000000800e48c40 does not define or inherit an implementation of the resolved method 'abstract void configure(java.lang.String, org.springframework.data.gemfire.client.ClientCacheFactoryBean)' of interface org.springframework.data.gemfire.config.annotation.ClientCacheConfigurer.
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.lambda$null$0(ClientCacheFactoryBean.java:118)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.lambda$new$1(ClientCacheFactoryBean.java:117)
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.lambda$applyClientCacheConfigurers$2(ClientCacheFactoryBean.java:156)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.applyClientCacheConfigurers(ClientCacheFactoryBean.java:156)
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.applyClientCacheConfigurers(ClientCacheFactoryBean.java:142)
    at org.springframework.data.gemfire.client.ClientCacheFactoryBean.applyCacheConfigurers(ClientCacheFactoryBean.java:129)
    at org.springframework.data.gemfire.CacheFactoryBean.afterPropertiesSet(CacheFactoryBean.java:177)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758)
    ... 29 more

After further investigation, I have traced down the problem.

The SBDG CacheNameAutoConfiguration class uses the SDG ClientCacheConfigurer interface to configure the "name" of the GemFire/Geode cache instance.

The SDG ClientCacheConfigurer interface was defined as this in SDG 2.1.5.RELEASE, which again is pulled in by Spring Boot 2.1.3.RELEASE. However, in SDG2.1.10.RELEASE, I [redefined][13] theClientCacheConfigurerinterface (now, an@FunctionalInterfaceas well) in terms of a baseConfigurer` interface (this). While they are the same interface logically, the (method resolution) byte code is no doubt different and therefore, the JRE cannot resolve the method.

You could try excluding the CacheNameAutoConfiguration class from your Spring Boot (auto) configuration, like so:

@SpringBootApplication(exclude = CacheNameAutoConfiguration.class)
class PccTestApplication { ... }

However, SBDG makes liberal use of the ClientCacheConfigurer @FunctionalInterface in several areas of SBDG's auto-configuraiton in order to customize the configuration of SDG, and GemFire/Geode, for conventions and convenience purposes on-behalf of the user.

In fact, I had to exclude both of these SBDG auto-configuration classes to get your example/test working correctly.

@SpringBootApplication(exclude = { 
    CacheNameAutoConfiguration.class, 
    ContinuousQueryAutoConfiguration.class 
})
class PccTestApplication { ... }

For more details on disable auto-configuration, see here and here.

However, I don't recommend approach as the answer, honestly.

It is pertinent that you use compatible versions, i.e. SBDG 1.1.0.RELEASE really ought to be paired with the baseline Spring Boot version 2.1.7.RELEASE.

Even more so, you should strongly consider using SBDG 1.1.6.RELEASE in the 1.1.x line with Spring Boot 2.1.13.RELEASE.

As mentioned in another SO post, SBDG 1.1.7.RELEASE with Spring Boot 2.1.14.RELEASE is due this Thursday, 4/30. See the Spring release calendar for more information.

I'd also recommend to go even further and upgrade to Spring Boot 2.2.x (currently, 2.2.6.RELEASE) with SBDG 1.2.6.RELEASE if at all possible.

Hope this helps!



来源:https://stackoverflow.com/questions/61434955/geode-gemfire-cannot-create-gemfirecache-bean-error-spring-boot-v2-1-3-gemfir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!