aspose file tools*
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Persistence Unit: Unable to build EntityManagerFactory" Watch "Persistence Unit: Unable to build EntityManagerFactory" New topic
Author

Persistence Unit: Unable to build EntityManagerFactory

Elangovan Shanmugam
Greenhorn

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.


Platform:
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
erDialect
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(Ejb3Configuration.java:677)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelCont
rollerContextAction.java:241)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerCo
ntextAction.java:109)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAc
tion.java:70)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContext
Action.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:
71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:5
1)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)


Elangovan Shanmugam
Greenhorn

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.

<provider>org.hibernate.ejb.HibernatePersistence</provider>

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!!!

Thanks
Elangovan S
Madhawi Maurya
Ranch Hand

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

<exclude-unlisted-classes>false</exclude-unlisted-classes>

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.


Thanks


SCJP1.5 with 90%
MaturiP kenae
Greenhorn

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="hibernate.hbm2ddl.auto" value="validate"/>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Persistence Unit: Unable to build EntityManagerFactory