This morning I upgraded my project to Spring Boot 4.1 with the following 2 plugin dependencies from the Spring Initializer:
id("org.springframework.boot") version "4.1.0"
id("org.graalvm.buildtools.native") version "1.1.1"
The GraalVM native image built successfully, but the application fails to start up with following stacktrace.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v4.1.0)
08:43:35.934 [main] INFO i.g.g.datastarspringmvc.Application - Starting AOT-processed Application using Java 25.0.3 with PID 1 (/workspace/io.github.gadnex.datastarspringmvc.Application started by cnb in /workspace) []
08:43:35.935 [main] INFO i.g.g.datastarspringmvc.Application - No active profile set, falling back to 1 default profile: "default" []
08:43:35.964 [main] INFO o.s.boot.tomcat.TomcatWebServer - Tomcat initialized with port 8080 (http) []
08:43:35.965 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat] []
08:43:35.965 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/11.0.22] []
08:43:35.975 [main] INFO o.s.b.w.c.s.WebApplicationContextInitializer - Root WebApplicationContext: initialization completed in 40 ms []
08:43:35.995 [main] WARN o.s.b.w.s.s.c.ServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator': Instantiation of supplied bean failed []
08:43:35.996 [main] INFO o.a.catalina.core.StandardService - Stopping service [Tomcat] []
Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator': Instantiation of supplied bean failed
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1250)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:565)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:371)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1225)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1121)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:994)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:621)
at org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:756)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:445)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
at io.github.gadnex.datastarspringmvc.Application.main(Application.java:15)
at java.base@25.0.3/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.<clinit>(AbstractConfigurationImpl.java:82)
at java.base@25.0.3/java.lang.Class.ensureInitialized(DynamicHub.java:778)
at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:31)
at jakarta.validation.Validation$GenericBootstrapImpl.configure(Validation.java:296)
at org.springframework.boot.validation.MessageInterpolatorFactory.getMessageInterpolator(MessageInterpolatorFactory.java:80)
at org.springframework.boot.validation.MessageInterpolatorFactory.getObject(MessageInterpolatorFactory.java:71)
at org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration.defaultValidator(ValidationAutoConfiguration.java:65)
at org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration__BeanDefinitions.lambda$getDefaultValidatorInstanceSupplier$0(ValidationAutoConfiguration__BeanDefinitions.java:33)
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68)
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$1(BeanInstanceSupplier.java:200)
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:231)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:1024)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1244)
... 20 more
Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.hibernate.validator.internal.util.logging.Log (implementation not found)
at org.jboss.logging.Logger.doGetMessageLogger(Logger.java:2632)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2536)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2521)
at org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:21)
at org.hibernate.validator.internal.util.Version.<clinit>(Version.java:18)
... 37 more
I was able to resolve my issue by reverting to:
id("org.springframework.boot") version "4.1.0"
id("org.graalvm.buildtools.native") version "0.11.5"
I also tested with a brand new project created from Spring Initializer with no code at all and the following dependencies:
plugins {
java
id("org.springframework.boot") version "4.1.0"
id("io.spring.dependency-management") version "1.1.7"
id("org.graalvm.buildtools.native") version "1.1.1"
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-webmvc")
testImplementation("org.springframework.boot:spring-boot-starter-validation-test")
testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
The application fails to start up for the same reason.
I am not really sure if this is an issue with Spring or with GraalVM, but thought I should report it.
This morning I upgraded my project to Spring Boot 4.1 with the following 2 plugin dependencies from the Spring Initializer:
The GraalVM native image built successfully, but the application fails to start up with following stacktrace.
I was able to resolve my issue by reverting to:
I also tested with a brand new project created from Spring Initializer with no code at all and the following dependencies:
The application fails to start up for the same reason.
I am not really sure if this is an issue with Spring or with GraalVM, but thought I should report it.