Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

springboot Upgrade from 2.3.5.RELEASE to 2.4.1- ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

I am trying to upgrade my kotlin - gradle project from springboot version 2.3.5.RELEASE to 2.4.1. Looks like there is version mismatch between springboot-2.4.1 and sping-cloud-Hoxton.SR9.

build.gradle.kts snippet

    plugins {         id("org.springframework.boot") version "2.4.1"         id("io.spring.dependency-management") version "1.0.10.RELEASE"              kotlin("jvm") version "1.4.10"     kotlin("plugin.spring") version "1.4.10"     kotlin("plugin.jpa") version "1.4.10"     kotlin("plugin.serialization") version "1.4.10"      idea     }          group = "com.xxx"     version = ""     java.sourceCompatibility = JavaVersion.VERSION_11     extra["springCloudVersion"] = "Hoxton.SR9"          val resilience4jVersion = "1.3.1"     val queryDslVersion = "4.4.0"     val springCloudVersion = "Hoxton.SR9"     val cucumberVersion = "6.7.0"     val camundaVersion = "7.14.0"     var jacocoVersion = "0.8.5"  dependencyManagement {     imports {         mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion")     } }   dependencies {      implementation("org.springframework.cloud:spring-cloud-starter-openfeign")     implementation("org.javers:javers-core:5.12.0")     implementation("io.jsonwebtoken:jjwt-api:0.11.1")     implementation("io.jsonwebtoken:jjwt-impl:0.11.1")     implementation("io.jsonwebtoken:jjwt-jackson:0.11.1")       implementation("org.springframework.boot:spring-boot-starter-mail")     implementation("org.springframework.boot:spring-boot-starter-data-jpa")     implementation("org.springframework.boot:spring-boot-starter-web")     implementation("org.springframework.boot:spring-boot-starter-hateoas")     // Aop dependency     implementation("org.springframework.boot:spring-boot-starter-aop")     implementation("com.fasterxml.jackson.module:jackson-module-kotlin")     implementation("org.jetbrains.kotlin:kotlin-reflect")     implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")     implementation("org.apache.httpcomponents:httpclient:4.5.12")      implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5")      implementation("com.fasterxml.jackson.core:jackson-databind:2.10.3")     implementation("com.fasterxml.jackson.core:jackson-core:2.10.3")     implementation("org.springframework.boot:spring-boot-starter-actuator")     implementation("javax.xml.bind:jaxb-api:2.3.0")      implementation("org.springframework.boot:spring-boot-starter-integration")     implementation("org.springframework.kafka:spring-kafka")     implementation("org.springframework.integration:spring-integration-kafka:3.3.0.RELEASE")     implementation("org.springframework.boot:spring-boot-starter-validation")     implementation("org.springframework.boot:spring-boot-starter-security")     implementation("org.springframework:spring-tx")      runtimeOnly("mysql:mysql-connector-java")     implementation("org.mariadb.jdbc:mariadb-java-client:2.6.0")      implementation("org.springdoc:springdoc-openapi-kotlin:1.4.3")     implementation("org.springdoc:springdoc-openapi-ui:1.4.3")     implementation("org.springdoc:springdoc-openapi-hateoas:1.4.3") } 

When I run the springboot application, I get following exception. The application was working properly before upgrading to the newer version.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@16f65612]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:586) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:244) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:767) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:572) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) ~[spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE]     at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) ~[spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE]     at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) ~[spring-cloud-context-2.2.6.RELEASE.jar:2.2.6.RELEASE]     at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) ~[spring-context-5.3.2.jar:5.3.2]     at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[spring-boot-2.4.1.jar:2.4.1]     at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) ~[na:na]     at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.1.jar:2.4.1]     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.1.jar:2.4.1]     at com.xxxx.MyApplicationKt.main(MyApplication.kt:22) ~[main/:na] Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@16f65612]     at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.2.jar:5.3.2]     at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.2.jar:5.3.2]     at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:417) ~[spring-orm-5.3.2.jar:5.3.2]     at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:388) ~[spring-orm-5.3.2.jar:5.3.2]     at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:335) ~[spring-orm-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1100) ~[spring-beans-5.3.2.jar:5.3.2]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.3.2.jar:5.3.2]     ... 31 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata     at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]     at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166) ~[na:na]     at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309) ~[na:na]     at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.2.jar:5.3.2]     ... 37 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]     ... 41 common frames omitted 

Please help me solving this issue.

like image 609
KarthiK Avatar asked Dec 29 '20 06:12

KarthiK


People also ask

What is the latest version of Org Springframework boot?

What is the latest Spring Boot version? The current stable version, as of October 2022, is Spring Boot 2.7.

Which version of spring does spring boot 2.4 use?

Spring Boot 2.4 uses Spring Framework 5.3.

Which of the below code bootstraps a spring boot application by creating appropriate ApplicationContext instance and loading all spring beans?

SpringApplication. run(Classname. class, args) bootstraps a spring application as a stand-alone application from the main method. It creates an appropriate ApplicationContext instance and load beans.

Where is spring boot dependencies?

Each release of Spring Boot provides a list of dependencies that it supports. The list of dependencies is available as a part of the Bills of Materials (spring-boot-dependencies) that can be used with Maven. So, we need not to specify the version of the dependencies in our configuration.


1 Answers

Hoxton is not compatible with Spring Boot 2.4 use 2020.0.0

like image 77
spencergibb Avatar answered Oct 07 '22 19:10

spencergibb