org.springframework.beans.factory.BeanCreationException

Error creating bean with name 'batchDatabaseInitializer': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from class path resource [org/springframework/batch/core/schema-h2.sql ]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/batch/core/schema-h2.sql ] cannot be opened because it does not exist

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Stack trace

  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDatabaseInitializer': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from class path resource [org/springframework/batch/core/schema-h2.sql ]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/batch/core/schema-h2.sql ] cannot be opened because it does not exist at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.csii.batch.service.BatchServiceApplication.main(BatchServiceApplication.java:20)[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0] at java.lang.reflect.Method.invoke(Method.java:483)[na:1.8.0] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)[spring-boot-devtools-1.4.0.RELEASE.jar:1.4.0.RELEASE] Caused by: org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from class path resource [org/springframework/batch/core/schema-h2.sql ]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/batch/core/schema-h2.sql ] cannot be opened because it does not exist at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:453)[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:231)[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.jdbc.datasource.init.DatabasePopulatorUtils.execute(DatabasePopulatorUtils.java:48)[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.initialize(BatchDatabaseInitializer.java:65)[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0] at java.lang.reflect.Method.invoke(Method.java:483)[na:1.8.0] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:310)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] ... 22 more Caused by: java.io.FileNotFoundException: class path resource [org/springframework/batch/core/schema-h2.sql ] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.core.io.support.EncodedResource.getReader(EncodedResource.java:140)[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.jdbc.datasource.init.ScriptUtils.readScript(ScriptUtils.java:281)[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:450)[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE] ... 32 more

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Unknown visitor
Unknown visitorOnce,
tvrmsmithtvrmsmith
2 times, last one
Unknown visitor
Unknown visitorOnce,
Unknown visitor
Unknown visitorOnce,
Unknown visitor
Unknown visitorOnce,
80 more bugmates