On return to a Geode reactive streams project after some time I would like to upgrade to latest spring-geode-starter. Perhaps related to Spring Boot Geode Unsatisfied dependency expressed through method 'sessionRegion' also on ClientCacheConfiguration what I think is a simple build.gradle dependencies gives exception:
2021-02-03T07:36:55,171 ERROR [main] org.springframework.boot.SpringApplication 856 reportFailure: Application run failed
java.lang.IllegalStateException: Error processing condition on org.springframework.geode.boot.autoconfigure.CachingProviderAutoConfiguration
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.shouldSkip(ConfigurationClassBeanDefinitionReader.java:489)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.shouldSkip(ConfigurationClassBeanDefinitionReader.java:478)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.shouldSkip(ConfigurationClassBeanDefinitionReader.java:478)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:348)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:252)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:285)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:99)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569)
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:63)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at app.FixApi.main(FixApi.java:23)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.data.gemfire.config.annotation.ClientCacheConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2f333739]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:754)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1737)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:753)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:692)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:663)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:238)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:169)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:119)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
... 20 more
Caused by: java.lang.NoClassDefFoundError: org/apache/geode/cache/client/SocketFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
... 36 more
Caused by: java.lang.ClassNotFoundException: org.apache.geode.cache.client.SocketFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 40 more
My build.gradle dependencies are:
dependencies {
group = 'api'
description = 'streaming api'
// This dependency is exported to consumers, that is to say found on their compile classpath.
// api 'org.apache.commons:commons-math3:3.6.1'
// Geode client dependency
implementation 'org.springframework.geode:spring-geode-starter:1.4.2'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation 'org.springframework.boot:spring-boot-starter-log4j2:2.4.2'
implementation 'com.lmax:disruptor:3.4.2'
implementation 'org.springframework.boot:spring-boot-starter-webflux:2.4.2'
implementation 'org.springframework.boot:spring-boot-starter-rsocket:2.4.2'
// tag::actuator[]
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.4.2'
// end::actuator[]
// HTML manager
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.4.2'
implementation 'com.google.guava:guava:30.1-jre'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.json:json:20201115'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'org.projectlombok:lombok:1.18.16'
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.1'
// Geode tests
testImplementation 'org.springframework.data:spring-data-geode-test:0.0.22'
// Other test dependencies
testImplementation 'io.projectreactor:reactor-test:3.4.2'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.data:spring-data-geode-test:0.0.22'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.4.2'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
I am not exactly sure how (reviewing your dependencies in the Gradle build shown above), but the
NoClassDefFoundError/ClassNotFoundExceptionon the Apache Geode API classorg.apache.geode.cache.client.SocketFactoryis caused by an incompatible version of Apache Geode (i.e. a version prior to1.13).The
SocketFactoryclass was in fact introduced in Apache Geode1.13(see here, then try here).Indeed SBDG
1.4.2pulls in SDG2.4.3, which is based on Apache Geode1.13.1. This is also apparent from the SBDG Version Compatibility Matrix.You might try running:
And searching for all the
org.apache.geode:geode-coredependencies (simply search for "geode-core") and see which versions of Apache Geode are being used, overridden, etc.But, anytime you see a
NoClassDefFoundError/ClassNotFoundExceptionorNoSuchMethodError, errors of that nature, you can bet that 9 out of 10 times you have a version problem.