You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SqlInitializationAutoConfiguration throws java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.init.DatabasePopulator without spring-jdbc.
SqlInitializationAutoConfiguration should be skipped when DatabasePopulator (from spring-jdbc) is unavailable.
My application does not need spring-jdbc or any database initialization.
As a workaround, I use: @SpringBootApplication(exclude = SqlInitializationAutoConfiguration.class)
SqlInitializationAutoConfiguration was added in Spring Boot 2.5.0 - #25323
The full stack trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfigura
tion.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer]: Factory m
ethod 'dataSourceScriptDatabaseInitializer' threw exception; nested exception is java.lang.NoClassDefFoundError: org.springframework.jdbc.datasource.init.DatabasePopulator
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$206.00000000117CDEA0.getObject(Unknown Source) ~[na:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.7.jar!/:5.3.7]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.7.jar!/:5.3.7]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.0.jar!/:2.5.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.5.0.jar!/:2.5.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) [spring-boot-2.5.0.jar!/:2.5.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:337) [spring-boot-2.5.0.jar!/:2.5.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1336) [spring-boot-2.5.0.jar!/:2.5.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1325) [spring-boot-2.5.0.jar!/:2.5.0]
at com.foo.bar.MySpringBootApplication.main(MySpringBootApplication.java:25) [classes!/:2.0.0-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90) ~[na:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) ~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:508) ~[na:1.8.0]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [my-app-spring-boot-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [my-app-spring-boot-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [my-app-spring-boot-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [my-app-spring-boot-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer]: Factory method 'dataSourceScriptDatabaseInitializer' threw exception; nested
exception is java.lang.NoClassDefFoundError: org.springframework.jdbc.datasource.init.DatabasePopulator
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.7.jar!/:5.3.7]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.7.jar!/:5.3.7]
... 28 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org.springframework.jdbc.datasource.init.DatabasePopulator
at org.springframework.boot.autoconfigure.sql.init.DataSourceInitializationConfiguration.dataSourceScriptDatabaseInitializer(DataSourceInitializationConfiguration.java:41) ~[spring-boot-autoconfigure-2.5.0.jar!/:2.5.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90) ~[na:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) ~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:508) ~[na:1.8.0]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.7.jar!/:5.3.7]
... 29 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.init.DatabasePopulator
at java.net.URLClassLoader.findClass(URLClassLoader.java:610) ~[na:1.8.0]
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:925) ~[na:2.9 (10-29-2018)]
at java.lang.ClassLoader.loadClass(ClassLoader.java:870) ~[na:2.9 (10-29-2018)]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151) ~[my-app-spring-boot-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at java.lang.ClassLoader.loadClass(ClassLoader.java:853) ~[na:2.9 (10-29-2018)]
... 35 common frames omitted
The text was updated successfully, but these errors were encountered:
wilkinsona
changed the title
SqlInitializationAutoConfiguration - fails without spring-jdbc
SqlInitializationAutoConfiguration fails when there is a DataSource bean but spring-jdbc is not on the classpath
Jun 10, 2021
wilkinsona
changed the title
SqlInitializationAutoConfiguration fails when there is a DataSource bean but spring-jdbc is not on the classpath
SqlInitializationAutoConfiguration fails when there is a DataSource bean and no spring-jdbc or a ConnectionFactory bean and no spring-r2dbc
Jun 10, 2021
SqlInitializationAutoConfiguration throws java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.init.DatabasePopulator without spring-jdbc.
SqlInitializationAutoConfiguration should be skipped when DatabasePopulator (from spring-jdbc) is unavailable.
My application does not need spring-jdbc or any database initialization.
As a workaround, I use:
@SpringBootApplication(exclude = SqlInitializationAutoConfiguration.class)
SqlInitializationAutoConfiguration was added in Spring Boot 2.5.0 - #25323
The full stack trace:
The text was updated successfully, but these errors were encountered: