Geode / Gemfire无法创建gemfireCache bean错误:Springboot v.2.1.3-Gemfire启动器1.1.0.RELEASE

问题描述 投票:0回答:1

我当前正在使用Springboot v.2.1.3连接到PCC w/ gemfire v9.6.1。基于SBDG兼容性矩阵,我尝试使用SBDG v1.1.0.RELEASE,我看到了以下问题。

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```

这是我的pom和配置。

<?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```

我已经尝试将所有Gemfire Starter 1.1.X版本与Springboot v2.1.3一起使用,但我看到类似的gemfireCache bean创建问题。有人可以让我知道我是否在此处遗漏任何东西,并帮助我搭配兼容的Gemfire入门程序,尤其是与Springboot v.2.1.3一起使用吗?

pivotal-cloud-foundry gemfire geode spring-data-gemfire spring-boot-data-geode
1个回答
0
投票

@@ Madmax-您引用哪个版本的兼容性矩阵?这是“官方” version compatibility matrix

如您所见,SBDG 1.1.x的最新版本是1.1.6.RELEASE,它是based on Spring Boot 2.1.13.RELEASE

如果回到SBDG 1.1.0.RELEASE,我们会看到它是based on Spring Boot 2.1.7.RELEASE。这会在传递依赖项上产生级联效应。

由于SBDG 1.1.0.RELEASE基于Spring Boot 2.1.7.RELEASE,这意味着SBDG 1.1.0.RELEASE也需要Spring Data Lovelace-SR10(引导pulled in时为2.1.7.RELEASE)。 Spring Data Lovelace-SR10hereincludes Apache Geode和Pivotal GemFire(SDG)2.1.10.RELEASE的Spring数据。因此,SBDG 1.1.0.RELEASE对Spring Boot 2.1.7.RELEASE和SDG 2.1.10.RELEASE的最低要求。

[如果我们对Spring Boot 2.1.3.RELEASE重复此练习,我们会看到Bootpulls inSpring Data Lovelace-SR5(here),即includes SDG 2.1.5.RELEASE。 SDG 2.1.5.RELEASE不满足SBDG 1.1.0.RELEASE的最低要求。

注意,这一直延伸到核心Spring Framework本身,因为Spring Boot也基于并引入了核心Spring Framework,并且Spring Data也基于核心Spring Framework。因此,所有版本必须对齐。

通常,您不能将不兼容的版本串在一起。如果版本兼容性矩阵(或更确切地说,是SBDG gradle.properties文件,for example)指出了直接或传递依赖项的特定版本,则期望并需要该依赖项的版本。

话虽如此,我基于Spring Boot 1.1.0.RELEASE使用SDDG 2.1.3.RELEASE设置了一个示例/测试项目,以查看是否可以重现您的错误。我做到了!但是,我得到了更精确的错误消息:

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

经过进一步调查,我找到了问题所在。

SBDG CacheNameAutoConfigurationuses SDG ClientCacheConfigurer接口,用于配置GemFire / Geode缓存实例的“名称”。

SDG ClientCacheConfigurer接口在SDG defined中为2.1.5.RELEASE,它再次由Spring Boot2.1.3.RELEASE. However, in SDG2.1.10.RELEASE, I [redefined][13] theClientCacheConfigurerinterface (now, an@FunctionalInterfaceas well) in terms of a baseConfigurer引入。接口(this)。尽管它们在逻辑上是相同的接口,但(方法分辨率)字节代码无疑是不同的,因此JRE无法解析该方法。

您可以尝试从Spring Boot(自动)配置中排除CacheNameAutoConfiguration类,如下所示:

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

但是,SBDG在SBDG auto-configuraiton

的多个区域中广泛使用ClientCacheConfigurer @FunctionalInterface,以自定义SDG和GemFire / Geode的配置,以代表惯例和方便的目的。用户。

实际上,我必须排除这两个SBDG auto-configuration

类,才能使您的示例/测试正常运行。
@SpringBootApplication(exclude = { 
    CacheNameAutoConfiguration.class, 
    ContinuousQueryAutoConfiguration.class 
})
class PccTestApplication { ... }

有关禁用自动配置的更多详细信息,请参见herehere

不过,老实说,我不建议使用方法作为答案。

与您使用兼容版本有关,即SBDG 1.1.0.RELEASE实际上应该与基准Spring Boot版本2.1.7.RELEASE配对。

更重要的是,您应该强烈考虑在Spring Boot 1.1.6.RELEASE1.1.x行中使用SBDG 2.1.13.RELEASE

[如另一篇SO帖子所述,带有Spring Boot 1.1.7.RELEASE的SBDG 2.1.14.RELEASE将于本周四4/30到期。有关更多信息,请参见Spring release calendar

如果可能的话,我还建议进一步升级并使用SBDG 2.2.x升级到Spring Boot 2.2.6.RELEASE(当前为1.2.6.RELEASE)。

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.