Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Description
Persistence 2.0 Spec, Chapter 8.2.1.5
In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider.
and need to provide one if it is not specified:
If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to correspond to it.
Without the jta-data-source element in the persistence.xml, the deployment fails to start:
08:53:57,004 WARN [org.hibernate.connection.UserSuppliedConnectionProvider] (MSC service thread 1-6) No connection properties specified - the user must supply JDBC connections
08:53:57,011 INFO [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider] (MSC service thread 1-5) Using provided datasource
08:53:57,017 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.persistenceunit."my_web.war#MY-EM": org.jboss.msc.service.StartException in service jboss.persistenceunit."my_web.war#MY-EM": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1363)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: MY-EM] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:911)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:169)
at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:78)