0 Ответы Последний ответ: 01.04.2014 3:40, автор: user10112541

    Exception when starting JPA,Hibernate Application on WebLogic 12c

    user10112541

      Hi,

       

      I have a JPA 2.0,Hibernate, Spring Application where the JPA entities use strategy = GenerationType.TABLE for Id

      generation using the JPA annotations @GeneratedValue and @TableGenerator.

       

      The application starts up well in Jboss-as-7.1.1.Final, currently we are migrating to WebLogic 12c and facing the following exception during startup.

       

      The class org.hibernate.id.MultipleHiLoPerTableGenerator seems to implement the class org.hibernate.id.IdentifierGenerator.

       

      Unable to identify the exact cause for it. Please Help.

       

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext-WS.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: myPersistanceUnit] Unable to build EntityManagerFactory

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

              Truncated. see log file for complete stacktrace

      Caused By: javax.persistence.PersistenceException: [PersistenceUnit: XYZEntity] Unable to build EntityManagerFactory

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)

              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)

              at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)

              at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)

              Truncated. see log file for complete stacktrace

      Caused By: org.hibernate.MappingException: Could not instantiate id generator [entity-name=XYZEntity]

              at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:123)

              at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:195)

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:318)

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1797)

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)

              Truncated. see log file for complete stacktrace

      Caused By: java.lang.ClassCastException: org.hibernate.id.MultipleHiLoPerTableGenerator cannot be cast to org.hibernate.id.IdentifierGenerator

              at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:115)

              at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:195)

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:318)

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1797)

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)

              Truncated. see log file for complete stacktrace

      >