entityManagerFactory issue in JBoss 7.1
durgesh.kabra Jul 9, 2013 12:32 PMHi,
I am getting BeanCreationException for entityManagerFactory.
It is an EAR application where i have a WAR inside it. As i am migrating from JBoss 4.2 to JBoss 7.1 coming across these issues.
I have gone through the migration steps and have done necessary changes. My datasource is properly initialized as per below log. I have done configuration settings in standalone.xml and have created the module accordingly
10:41:08,878 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ebsbpDS]
Below are my application details:
persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="billingGroupService" transaction-type="JTA"> <!-- transaction-type="JTA" -->
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/ebsbpDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.archive.autodetection" value="class, hbm" />
</properties>
</persistence-unit>
</persistence>
applicationContext-jpa.xml
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitName" value="billingGroupService" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="false"/>
<property name="showSql" value="false" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${database.hibernate.dialect}</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" p:entityManagerFactory-ref="entityManagerFactory" />
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" p:jndiName="${ebsbp.jndi.jdbcContext.service}" p:resourceRef="true"/>
Here is the stacktrace from the log:
10:43:21,999 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-2) Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [ebsbpPropertyPlaceholderConfigurer,billingGroupServiceDAO,adpChargesServiceDAO,printingServiceDAO,userServiceDAO,emailServiceSpringDAO,inceptionDateDAO,jdbcTemplate,ebsDispatcher,rraPropertyPlaceholderConfigurer2,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor,dataSource]; root of BeanFactory hierarchy]
10:43:22,460 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-2) Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [ebsbpPropertyPlaceholderConfigurer,billingGroupServiceDAO,adpChargesServiceDAO,printingServiceDAO,userServiceDAO,emailServiceSpringDAO,inceptionDateDAO,jdbcTemplate,ebsDispatcher,rraPropertyPlaceholderConfigurer2,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor,dataSource]; root of BeanFactory hierarchy}
10:43:22,490 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'billingGroupServiceDAO' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jpa.xml]: Invocation of init method failed; nested exception is java.lang.StackOverflowError
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:254) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:290) [spring-2.0.jar:2.0]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348) [spring-2.0.jar:2.0]
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) [spring-2.0.jar:2.0]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) [spring-2.0.jar:2.0]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) [spring-2.0.jar:2.0]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) [spring-2.0.jar:2.0]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_14]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_14]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_14]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/applicationContext-jpa.xml]: Invocation of init method failed; nested exception is java.lang.StackOverflowError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1032) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156) [spring-2.0.jar:2.0]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246) [spring-2.0.jar:2.0]
... 22 more
Caused by: java.lang.StackOverflowError
at org.apache.xerces.util.URI.isConformantSchemeName(URI.java:1213) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.util.URI.setScheme(URI.java:904) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.util.URI.initializeScheme(URI.java:576) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.util.URI.initialize(URI.java:400) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.util.URI.<init>(URI.java:211) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.util.URI.<init>(URI.java:195) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.XMLEntityManager.expandSystemId(XMLEntityManager.java:1140) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.XMLEntityManager.resolveEntity(XMLEntityManager.java:581) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.xsdToXMLInputSource(XMLSchemaLoader.java:625) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:580) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588) [xercesImpl-2.0.2.jar:]
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489) [xercesImpl-2.0.2.jar:]
Is it related to xercesImpl-2.0.2.jar? or it is related to Hibernate? As i am using Hibernate 3.2 in my application.
Please suggest.
@ DK