File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Persistence Unit: Unable to build EntityManagerFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Persistence Unit: Unable to build EntityManagerFactory" Watch "Persistence Unit: Unable to build EntityManagerFactory" New topic

Persistence Unit: Unable to build EntityManagerFactory

Elangovan Shanmugam

Joined: Sep 06, 2009
Posts: 10
Hi all, I am facing an issue while deploying my application. When I deployed my war file onto JBoss server, I am getting an as follows. Please let me know what could be wrong. Appreciate your help so much.

Jboss 5.1
Hibernate 3.1 GA
Microsoft SQL Server
JTds 1.2 jdbc driver

23:14:10,708 INFO [SettingsFactory] JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2.2
23:14:10,739 ERROR [STDERR] 547 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.SQLServ
23:14:10,864 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#ab state=Create

javax.persistence.PersistenceException: [PersistenceUnit: ab] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelCont
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerCo
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAc
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContext
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(
at org.jboss.dependency.plugins.AbstractControllerContext.install(
at org.jboss.dependency.plugins.AbstractController.install(

Elangovan Shanmugam

Joined: Sep 06, 2009
Posts: 10
I think I figured what is the issue.

I needed to add <provider> element as below. This element needs to be just after <persistence-unit...> element.


This solved the issue. I am no more getting the "Unable to build EntityManagerFactory" error. But I am not a next issue and different topic... looks like this is happening because of version mismatch between what has been shipped with Jboss vs What I am using in my project!!!

Elangovan S
Madhawi Maurya
Ranch Hand

Joined: Aug 22, 2007
Posts: 42
I have added a tag


which will exclude the classes which have @Entity annotation and not mapped into persistence.xml file.

After adding this tag my this problem has solved.


SCJP1.5 with 90%
MaturiP kenae

Joined: Jun 21, 2012
Posts: 1
Hai I have removed tag, it is working fine for me. which validate the when application deploys in starting.

<property name="" value="validate"/>
I agree. Here's the link:
subject: Persistence Unit: Unable to build EntityManagerFactory
It's not a secret anymore!