Has anyone seen this error with kotlin reflection ...
# spring
w
Has anyone seen this error with kotlin reflection in spring boot 4? 🧵
Copy code
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [ExampleApplication]: kotlin/reflect/jvm/ReflectJvmMapping
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:644)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:362)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:283)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:206)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:174)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:442)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:306)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:782)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:600)
	at org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$2(SpringBootContextLoader.java:144)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
	at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1444)
	at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:563)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:144)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:110)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:246)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:157)
	... 19 more
Caused by: java.lang.NoClassDefFoundError: kotlin/reflect/jvm/ReflectJvmMapping
	at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:909)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:190)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:151)
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:613)
	... 42 more
my build file looks like
Copy code
plugins {
    application
    id("org.springframework.boot") version ("4.+")
    kotlin("jvm") version ("2.2.0")
}
dependencies {
    kotlin("stdlib-jdk8")
    kotlin("reflect")
    implementation(platform("org.springframework:spring-framework-bom:7.0.0-M7"))
    implementation("org.springframework:spring-beans")
    implementation("org.springframework:spring-webmvc")
    implementation("org.springframework.boot:spring-boot-autoconfigure:4.0.0-M1")
    implementation("org.springframework.boot:spring-boot-starter-jetty:4.0.0-M1")
    implementation("io.github.oshai:kotlin-logging-jvm:5.1.0")
    implementation("ch.qos.logback:logback-classic:1.5.18")

    testImplementation("org.springframework.boot:spring-boot-starter-test:4.0.0-M1")
    testImplementation("org.springframework.boot:spring-boot-starter-webflux:4.0.0-M1")
    testImplementation("org.assertj:assertj-core:3.27.3")
}
oh wait rubber duck i dont have
implementation
in front of the kotlin deps lol
rubber duck 1
😁 2