I was trying to upgrade the version cloud sdk jar from 3.36.0 to 3.42.0. Build was successful. However, during the application start i got the following error:
16:51:52.752 [main] ERROR org.springframework.boot.SpringApplication [{}] - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configureRetry' defined in class path resource [com/sap/requisitioning/config/ResilienceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.github.resilience4j.retry.Retry]: Factory method 'configureRetry' threw exception; nested exception is java.lang.NoClassDefFoundError: io/github/resilience4j/core/IntervalBiFunction
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.5.jar:5.3.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:769) ~[spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313) [spring-boot-2.4.4.jar:2.4.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) [spring-boot-2.4.4.jar:2.4.4]
at com.sap.requisitioning.RequisitionApplication.main(RequisitionApplication.java:15) [classes/:?]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.github.resilience4j.retry.Retry]: Factory method 'configureRetry' threw exception; nested exception is java.lang.NoClassDefFoundError: io/github/resilience4j/core/IntervalBiFunction
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.5.jar:5.3.5]
... 20 more
Caused by: java.lang.NoClassDefFoundError: io/github/resilience4j/core/IntervalBiFunction
at io.github.resilience4j.retry.RetryConfig.<clinit>(RetryConfig.java:40) ~[resilience4j-retry-1.7.0.jar:1.7.0]
at com.sap.requisitioning.config.ResilienceConfig.configureRetry(ResilienceConfig.java:54) ~[classes/:?]
at com.sap.requisitioning.config.ResilienceConfig$$EnhancerBySpringCGLIB$$c3bd3c93.CGLIB$configureRetry$0(<generated>) ~[classes/:?]
at com.sap.requisitioning.config.ResilienceConfig$$EnhancerBySpringCGLIB$$c3bd3c93$$FastClassBySpringCGLIB$$a8f1b6a5.invoke(<generated>) ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.5.jar:5.3.5]
at com.sap.requisitioning.config.ResilienceConfig$$EnhancerBySpringCGLIB$$c3bd3c93.configureRetry(<generated>) ~[classes/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.5.jar:5.3.5]
... 20 more
Caused by: java.lang.ClassNotFoundException: io.github.resilience4j.core.IntervalBiFunction
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[?:?]
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
at io.github.resilience4j.retry.RetryConfig.<clinit>(RetryConfig.java:40) ~[resilience4j-retry-1.7.0.jar:1.7.0]
at com.sap.requisitioning.config.ResilienceConfig.configureRetry(ResilienceConfig.java:54) ~[classes/:?]
at com.sap.requisitioning.config.ResilienceConfig$$EnhancerBySpringCGLIB$$c3bd3c93.CGLIB$configureRetry$0(<generated>) ~[classes/:?]
at com.sap.requisitioning.config.ResilienceConfig$$EnhancerBySpringCGLIB$$c3bd3c93$$FastClassBySpringCGLIB$$a8f1b6a5.invoke(<generated>) ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.5.jar:5.3.5]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.5.jar:5.3.5]
at com.sap.requisitioning.config.ResilienceConfig$$EnhancerBySpringCGLIB$$c3bd3c93.configureRetry(<generated>) ~[classes/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.5.jar:5.3.5]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.5.jar:5.3.5]
... 20 more
Looks like something to with 'retry' class in resilience jar. Please let me know the solution.
It seems there is a version conflict in your dependency setup of your
pom.xml
. Please runmvn dependency:tree
and investigate. Make sureresilience4j-core
has one version referenced only. Use<exclusions>
to avoid an old transitive version or<dependencyManagement>
/<dependency>
to enforce a specific version of Resilience4j.Please find this guide on dealing with dependency conflicts in the SAP Cloud SDK documentation.