Spring Data GemFire 2.0.1.RELEASE 抛出初始化错误
Spring Data GemFire 2.0.1.RELEASE is throwing an Initialization Error
最初,我的应用程序 运行 使用 spring-data-gemfire 1.9.7.RELEASE 没问题。但是,在升级到 spring-data-gemfire 2.0.1.RELEASE 后,我的应用程序无法启动并抛出初始化错误,如下所示:
C:\Dev\projects\JavaWebClient\web\target>java -jar
web-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/\ / ' __ _ ()_ __ __ _ \ \ \ \
( ( )_ | '_ | '| | ' / ` | \ \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |____| .|| ||| |__, | / / / /
=========|_|==============|___/=///_/
:: Spring Boot :: (v1.5.8.RELEASE)
[info 2017/11/15 19:07:23.999 EAT tid=0x1] Starting
JavaWebClientApplication v0.0.1-SNAPSHOT on MY-PC with PID 13804
(C:\Dev\projects\JavaWebClient\web\target\web-0.0.1-SNAPSHOT.jar
started by edwards in C:\Dev\projects\JavaWebClient\web\target)
[info 2017/11/15 19:07:24.019 EAT tid=0x1] No active profile
set, falling back to default profiles: default
[info 2017/11/15 19:07:24.812 EAT tid=0x1] Refreshing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152:
startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context
hierarchy
[error 2017/11/15 19:07:25.892 EAT tid=0x1] Application startup
failed java.lang.NoSuchMethodError:
org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;
at org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension.registerBeansForRoot(GemfireRepositoryConfigurationExtensi
on.java:120)
at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:116)
at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.
java:83)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars[=12=](ConfigurationClassBeanDefini
tionReader.java:360)
at java.util.LinkedHashMap.forEach(Unknown Source)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReade
r.java:359)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefiniti
onReader.java:144)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.ja
va:273)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.nftconsult.gemfire.web.JavaWebClientApplication.main(JavaWebClientApplication.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
[info 2017/11/15 19:07:25.897 EAT tid=0x1] Closing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152:
startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context
hierarchy
[warn 2017/11/15 19:07:25.901 EAT tid=0x1] Exception thrown
from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized -
call 'refresh' before invoking lifecycle methods via the context:
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152:
startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:433)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1004)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.nftconsult.gemfire.web.JavaWebClientApplication.main(JavaWebClientApplication.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
[error 2017/11/15 19:07:25.905 EAT tid=0x1] Destroy method on
bean with name
'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory
' threw an exception java.lang.IllegalStateException:
ApplicationEventMulticaster not initialized - call 'refresh' before
multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152:
startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:420)
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:95)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:576)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:552)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:953)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:521)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:227)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:960)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1035)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1011)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.nftconsult.gemfire.web.JavaWebClientApplication.main(JavaWebClientApplication.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
C:\Dev\projects\JavaWebClient\web\target>
这并不奇怪,因为您的 Spring 应用程序基于 Spring Boot 1.5.8.RELEASE
并且目前尚不清楚您是如何专门将 Spring Data GemFire 依赖项从 1.9.7.RELEASE
升级到 2.0.1.RELEASE
.
问题是,您引入了 Spring Data Commons 的不兼容版本,我怀疑还有其他几个 Spring 依赖项(例如核心 Spring Framework),因为您的应用程序植根于 Spring Boot 1.5.8.RELEASE
。因此 java.lang.NoSuchMethodError
错误...
java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;
at org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension.registerBeansForRoot(GemfireRepositoryConfigurationExtensi on.java:120)
首先,您需要了解所有 Spring Data modules(参见“主要模块”、“社区模块”和“相关模块”和关于“Release train”的部分(在 SD 项目页面上)建立在两者的特定版本上 Spring 数据共享 和核心Spring 框架。您不能 只升级 1 个依赖项而不期望升级其他依赖项。
SD 发布序列(例如 Ingalls or Kay) are all based on a particular version of Spring Data Commons and the core Spring Framework. For instance, with SD Kay, see "Core themes" and "Participating modules"。
java.lang.NoSuchMethodError
之所以特别发生,是因为您使用的是 Spring Data Commons 的不兼容版本(即来自 Ingalls,即 pulled in by Spring Boot 1.5.x) with Spring Data GemFire 2.0.1.RELEASE
, which comes from SD Kay,预计 SDC 2.0.x.RELEASE
。
这个class,(即org.springframework.data.repository.config.RepositoryConfigurationSource
) is a Spring Data Commons class. Clearly the method signature (i.e. getAttribute(:String):String
) in SDC 1.13.8
(Ingalls) for the method in question is not what SDG 2.0.1.RELEASE
expects (i.e. getAttribute(:String):Optional<String>
), which comes from SDC 2.0.1.RELEASE
。
Spring Boot 以及 Spring IO 平台 是有原因的, 提供一组精心策划和协调的依赖项,这些依赖项都已经过测试并且证明可以协同工作。当您偏离规定的依赖关系时,您需要注意这一点。
从技术上讲,只有即将发布的 Spring Boot 2.0 版本才会 based on SD 凯.
但是,如果您确实需要 Spring Boot(即 1.5.8.RELEASE
,当前最新版本)的 GA 版本并希望使用 Spring Data GemFire 2.0.1.RELEASE
, or Kay-SR1, 那幸好你走运了!
我也想用 Spring Data Kay 最新的 GA 版本 Spring Boot(即1.5.8.RELEASE)中的Spring IO Guides (for instance) to showcase the new features in Spring Data GemFire 2.0.x
Kay, since many things have changed for the better (like this).
我能够让它工作,但我需要在 Maven(或 Gradle)构建文件中设置特定的东西,例如 overriding the dependency versions of SD and the core Spring Framework managed by Spring Boot (specifically this, and this). Note this as well. Also note my dependencies.
Gradle 有点棘手,但是你可以看到新的构建文件 here and compare it with the previous version here.
无论如何,下次你争论依赖版本时记住这些事情,这就是为什么首先创建 Spring IO 平台 的全部原因, 管理所有依赖关系和依赖关系的依赖关系(即传递依赖关系)在可能发生时overlap/conflicts(因为某些传递依赖关系将具有相同的依赖关系),等等,等等
希望对您有所帮助!
此致,
-j
最初,我的应用程序 运行 使用 spring-data-gemfire 1.9.7.RELEASE 没问题。但是,在升级到 spring-data-gemfire 2.0.1.RELEASE 后,我的应用程序无法启动并抛出初始化错误,如下所示:
C:\Dev\projects\JavaWebClient\web\target>java -jar web-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/\ / ' __ _ ()_ __ __ _ \ \ \ \
( ( )_ | '_ | '| | ' / ` | \ \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |____| .|| ||| |__, | / / / /
=========|_|==============|___/=///_/
:: Spring Boot :: (v1.5.8.RELEASE)[info 2017/11/15 19:07:23.999 EAT tid=0x1] Starting JavaWebClientApplication v0.0.1-SNAPSHOT on MY-PC with PID 13804 (C:\Dev\projects\JavaWebClient\web\target\web-0.0.1-SNAPSHOT.jar started by edwards in C:\Dev\projects\JavaWebClient\web\target)
[info 2017/11/15 19:07:24.019 EAT tid=0x1] No active profile set, falling back to default profiles: default
[info 2017/11/15 19:07:24.812 EAT tid=0x1] Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152: startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context hierarchy
[error 2017/11/15 19:07:25.892 EAT tid=0x1] Application startup failed java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional; at org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension.registerBeansForRoot(GemfireRepositoryConfigurationExtensi on.java:120) at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:116) at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport. java:83) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars[=12=](ConfigurationClassBeanDefini tionReader.java:360) at java.util.LinkedHashMap.forEach(Unknown Source) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReade r.java:359) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefiniti onReader.java:144) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.ja va:273) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.nftconsult.gemfire.web.JavaWebClientApplication.main(JavaWebClientApplication.java:173) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
[info 2017/11/15 19:07:25.897 EAT tid=0x1] Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152: startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context hierarchy
[warn 2017/11/15 19:07:25.901 EAT tid=0x1] Exception thrown from LifecycleProcessor on context close java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152: startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:433) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1004) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.nftconsult.gemfire.web.JavaWebClientApplication.main(JavaWebClientApplication.java:173) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
[error 2017/11/15 19:07:25.905 EAT tid=0x1] Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory ' threw an exception java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152: startup date [Wed Nov 15 19:07:24 EAT 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:420) at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:95) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:240) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:576) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:552) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:953) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:521) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:227) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:960) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1035) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1011) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.nftconsult.gemfire.web.JavaWebClientApplication.main(JavaWebClientApplication.java:173) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
C:\Dev\projects\JavaWebClient\web\target>
这并不奇怪,因为您的 Spring 应用程序基于 Spring Boot 1.5.8.RELEASE
并且目前尚不清楚您是如何专门将 Spring Data GemFire 依赖项从 1.9.7.RELEASE
升级到 2.0.1.RELEASE
.
问题是,您引入了 Spring Data Commons 的不兼容版本,我怀疑还有其他几个 Spring 依赖项(例如核心 Spring Framework),因为您的应用程序植根于 Spring Boot 1.5.8.RELEASE
。因此 java.lang.NoSuchMethodError
错误...
java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;
at org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension.registerBeansForRoot(GemfireRepositoryConfigurationExtensi on.java:120)
首先,您需要了解所有 Spring Data modules(参见“主要模块”、“社区模块”和“相关模块”和关于“Release train”的部分(在 SD 项目页面上)建立在两者的特定版本上 Spring 数据共享 和核心Spring 框架。您不能 只升级 1 个依赖项而不期望升级其他依赖项。
SD 发布序列(例如 Ingalls or Kay) are all based on a particular version of Spring Data Commons and the core Spring Framework. For instance, with SD Kay, see "Core themes" and "Participating modules"。
java.lang.NoSuchMethodError
之所以特别发生,是因为您使用的是 Spring Data Commons 的不兼容版本(即来自 Ingalls,即 pulled in by Spring Boot 1.5.x) with Spring Data GemFire 2.0.1.RELEASE
, which comes from SD Kay,预计 SDC 2.0.x.RELEASE
。
这个class,(即org.springframework.data.repository.config.RepositoryConfigurationSource
) is a Spring Data Commons class. Clearly the method signature (i.e. getAttribute(:String):String
) in SDC 1.13.8
(Ingalls) for the method in question is not what SDG 2.0.1.RELEASE
expects (i.e. getAttribute(:String):Optional<String>
), which comes from SDC 2.0.1.RELEASE
。
Spring Boot 以及 Spring IO 平台 是有原因的, 提供一组精心策划和协调的依赖项,这些依赖项都已经过测试并且证明可以协同工作。当您偏离规定的依赖关系时,您需要注意这一点。
从技术上讲,只有即将发布的 Spring Boot 2.0 版本才会 based on SD 凯.
但是,如果您确实需要 Spring Boot(即 1.5.8.RELEASE
,当前最新版本)的 GA 版本并希望使用 Spring Data GemFire 2.0.1.RELEASE
, or Kay-SR1, 那幸好你走运了!
我也想用 Spring Data Kay 最新的 GA 版本 Spring Boot(即1.5.8.RELEASE)中的Spring IO Guides (for instance) to showcase the new features in Spring Data GemFire 2.0.x
Kay, since many things have changed for the better (like this).
我能够让它工作,但我需要在 Maven(或 Gradle)构建文件中设置特定的东西,例如 overriding the dependency versions of SD and the core Spring Framework managed by Spring Boot (specifically this, and this). Note this as well. Also note my dependencies.
Gradle 有点棘手,但是你可以看到新的构建文件 here and compare it with the previous version here.
无论如何,下次你争论依赖版本时记住这些事情,这就是为什么首先创建 Spring IO 平台 的全部原因, 管理所有依赖关系和依赖关系的依赖关系(即传递依赖关系)在可能发生时overlap/conflicts(因为某些传递依赖关系将具有相同的依赖关系),等等,等等
希望对您有所帮助!
此致, -j