org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationStartUp' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: com.adwork] Unable to build Hibernate SessionFactory

Stack Overflow | Aman Nagarkoti | 2 months ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to poroszd and rafael . Or join the community to write better ones.
  1. 0
    samebug tip
    You need to deploy aspectJ (aspectjweaver.jar) together with your application. Add it to your pom.xml
  2. 0
    samebug tip
    If you want to keep using @EnableWebMvc annotation, you have to add the code on the first answer of this page: https://goo.gl/JoHTKU to your code
  3. 0
    samebug tip
    Springboot auto-configuration is disabled when you try to use WebMvcConfigurerAdapter and @EnableWebMvc. If WebConfig is not of the essence, remove it and use SpringBoot auto-configuration.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    Mixed JpaTransactionManager with JTA transaction type in the beans.xml and persistence.xml
    via spring.io
  6. 0

    javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory - Javafree: O fórum de Java que mais cresce

    com.br | 2 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: punit] Unable to build EntityManagerFactory
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.postgresql.util.PSQLException

    ERROR: column "createddate" of relation "person" already exists

    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse()
  2. PostgreSQL JDBC Driver
    AbstractJdbc2Statement.executeUpdate
    1. org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
    2. org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
    3. org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    4. org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
    5. org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:406)
    6. org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
    6 frames
  3. org.hibernate.tool
    SchemaMigratorImpl.doMigration
    1. org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:56)
    2. org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:420)
    3. org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:438)
    4. org.hibernate.tool.schema.internal.SchemaMigratorImpl.migrateTable(SchemaMigratorImpl.java:247)
    5. org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigrationToTargets(SchemaMigratorImpl.java:170)
    6. org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:60)
    6 frames
  4. Hibernate
    SessionFactoryImpl.<init>
    1. org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:129)
    2. org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:97)
    3. org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:481)
    3 frames
  5. org.hibernate.boot
    SessionFactoryBuilderImpl.build
    1. org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
    1 frame
  6. org.hibernate.jpa
    HibernatePersistenceProvider.createEntityManagerFactory
    1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
    2. org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
    2 frames
  7. JavaEE 7
    Persistence.createEntityManagerFactory
    1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
    2. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
    2 frames
  8. com.adwork.survey
    ApplicationStartUp.initIt
    1. com.adwork.survey.config.ApplicationStartUp.initIt(ApplicationStartUp.java:27)
    1 frame
  9. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    4. java.lang.reflect.Method.invoke(Unknown Source)
    4 frames
  10. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1706)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1645)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    6. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    7. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    8. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    9. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    10. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)
    10 frames
  11. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    2 frames
  12. Spring
    ContextLoaderListener.contextInitialized
    1. org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
    2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
    3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    3 frames
  13. Glassfish Core
    HostConfig$DeployDescriptor.run
    1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
    2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
    3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    4. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    5. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    6. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    7. org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596)
    8. org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805)
    8 frames
  14. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    2. java.util.concurrent.FutureTask.run(Unknown Source)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    5. java.lang.Thread.run(Unknown Source)
    5 frames