org.springframework.beans.factory.BeanCreationException

tip

Check if you're not creating unused SQL entities, as it might cause this exception.


rafaelrafael

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

  • Layers not saved in the workspace
    via GitHub by gpetit
    ,
  • H2 and Oracle Compatiability issues
    via Stack Overflow by john
    ,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookingRepository': Cannot create inner bean '(inner bean)#126f8f24' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#126f8f24': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of URL [file:/C:/Users/Naveen/Documents/workspace-sts-3.8.0.RELEASE/BookingManagement/target/classes/data.sql]: insert into booking(booking_name) values("Chris"); nested exception is org.h2.jdbc.JdbcSQLException: Column "Chris" not found; SQL statement: insert into booking(booking_name) values("Chris") [42122-192] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)[spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)[spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)[spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)[spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)[spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at com.example.BookingManagementApplication.main(BookingManagementApplication.java:20)[classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookingRepository': Cannot create inner bean '(inner bean)#126f8f24' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#126f8f24': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of URL [file:/C:/Users/Naveen/Documents/workspace-sts-3.8.0.RELEASE/BookingManagement/target/classes/data.sql]: insert into booking(booking_name) values("Chris"); nested exception is org.h2.jdbc.JdbcSQLException: Column "Chris" not found; SQL statement: insert into booking(booking_name) values("Chris") [42122-192] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:187)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1213)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1053)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1018)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] ... 19 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#126f8f24': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of URL [file:/C:/Users/Naveen/Documents/workspace-sts-3.8.0.RELEASE/BookingManagement/target/classes/data.sql]: insert into booking(booking_name) values("Chris"); nested exception is org.h2.jdbc.JdbcSQLException: Column "Chris" not found; SQL statement: insert into booking(booking_name) values("Chris") [42122-192] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:448)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] ... 33 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of URL [file:/C:/Users/Naveen/Documents/workspace-sts-3.8.0.RELEASE/BookingManagement/target/classes/data.sql]: insert into booking(booking_name) values("Chris"); nested exception is org.h2.jdbc.JdbcSQLException: Column "Chris" not found; SQL statement: insert into booking(booking_name) values("Chris") [42122-192] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1600)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] ... 41 more Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of URL [file:/C:/Users/Naveen/Documents/workspace-sts-3.8.0.RELEASE/BookingManagement/target/classes/data.sql]: insert into booking(booking_name) values("Chris"); nested exception is org.h2.jdbc.JdbcSQLException: Column "Chris" not found; SQL statement: insert into booking(booking_name) values("Chris") [42122-192] at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:494)[spring-jdbc-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:231)[spring-jdbc-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.jdbc.datasource.init.DatabasePopulatorUtils.execute(DatabasePopulatorUtils.java:48)[spring-jdbc-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.runScripts(DataSourceInitializer.java:169)[spring-boot-autoconfigure-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.runDataScripts(DataSourceInitializer.java:119)[spring-boot-autoconfigure-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.onApplicationEvent(DataSourceInitializer.java:110)[spring-boot-autoconfigure-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.onApplicationEvent(DataSourceInitializer.java:48)[spring-boot-autoconfigure-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382)[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.postProcessAfterInitialization(DataSourceInitializedPublisher.java:70)[spring-boot-autoconfigure-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1723)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:113)[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE] ... 45 more Caused by: org.h2.jdbc.JdbcSQLException: Column "Chris" not found; SQL statement: insert into booking(booking_name) values("Chris") [42122-192] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)[h2-1.4.192.jar:1.4.192] at org.h2.message.DbException.get(DbException.java:179)[h2-1.4.192.jar:1.4.192] at org.h2.message.DbException.get(DbException.java:155)[h2-1.4.192.jar:1.4.192] at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:147)[h2-1.4.192.jar:1.4.192] at org.h2.command.dml.Insert.prepare(Insert.java:270)[h2-1.4.192.jar:1.4.192] at org.h2.command.Parser.prepareCommand(Parser.java:259)[h2-1.4.192.jar:1.4.192] at org.h2.engine.Session.prepareLocal(Session.java:560)[h2-1.4.192.jar:1.4.192] at org.h2.engine.Session.prepareCommand(Session.java:501)[h2-1.4.192.jar:1.4.192] at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1202)[h2-1.4.192.jar:1.4.192] at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:170)[h2-1.4.192.jar:1.4.192] at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)[h2-1.4.192.jar:1.4.192] at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:473)[spring-jdbc-4.3.1.RELEASE.jar:4.3.1.RELEASE] ... 59 more

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    tvrmsmithtvrmsmith
    1 times, last one,
    archenrootarchenroot
    1 times, last one,
    Andreas HäberAndreas Häber
    5 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    143 more bugmates